user27726: I am new to arduino and I want to interface it using java . I want to know is there a way to change the variable or set the variable using the input from java :D Thanks For reading Hope you can answer my question .. Sorry for my english not my first language :D 

user27732: Although you can't straight-up change variables on the Arduino, you can create your own protocol over a serial connection using processing (https://processing.org) on your computer, and a sketch on Arduino.
Use the function
Serial.begin(9600);

on the arduino to initialise a serial connection to your computer, and then in processing use the lines:
Serial myPort;    // Initialise a serial object (do this at the start of the program)

// Inside the setup() function:
String portName = Serial.list()[0];    // Get the first portname on the list (this may need to be changed to get the right one)
myPort = new Serial(this, portName, 9600);

to connect from the computer.
Once you have done this, you can use the functions 
myPort.write();

in processing, and
val = Serial.read();

To recieve data on the arduino.
Source (see here for more info): https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all

27726: <p>I am new to arduino and I want to interface it using java . I want to know is there a way to change the variable or set the variable using the input from java :D Thanks For reading Hope you can answer my question .. Sorry for my english not my first language :D </p>
 27732: <p>Although you can't straight-up change variables on the Arduino, you can create your own protocol over a serial connection using processing (<a href="https://processing.org" rel="nofollow">https://processing.org</a>) on your computer, and a sketch on Arduino.</p>

<p>Use the function</p>

<pre><code>Serial.begin(9600);
</code></pre>

<p>on the arduino to initialise a serial connection to your computer, and then in processing use the lines:</p>

<pre><code>Serial myPort;    // Initialise a serial object (do this at the start of the program)

// Inside the setup() function:
String portName = Serial.list()[0];    // Get the first portname on the list (this may need to be changed to get the right one)
myPort = new Serial(this, portName, 9600);
</code></pre>

<p>to connect from the computer.</p>

<p>Once you have done this, you can use the functions </p>

<pre><code>myPort.write();
</code></pre>

<p>in processing, and</p>

<pre><code>val = Serial.read();
</code></pre>

<p>To recieve data on the arduino.</p>

<p>Source (see here for more info): <a href="https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all" rel="nofollow">https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all</a></p>
