All the online/manual and online tutorials explain how to initially assign something to a variable, but how do you change it when the program is running? In BASIC something like "if a$ = 2 then b$ = 3"

Also how can you take a string, say an input and assign it to a variable instead of using "system.out.println"

But how do you do this in JAVA? I'm not used to high level programming - BASIC is about as high level as I know.

Cheers,

Dave.

02-16-2004, 11:22 PM

sad69

Java is about as high level as BASIC is, I think.

Java doesn't refer to variables with a $ in front.

For example:

Code:

int a, b;
a = 5;
b = 3;
a = b + 2;
b = 4;

The Java version of your BASIC code would be:

Code:

if(a == 2)
b = 3;

As far as strings go, Java has an object called String. Here are some examples with String:

I'm not sure what else you need. There are plenty of tutorials online regarding this sort of stuff. I also think it would be good to look at some sample code programs and try to step through them and figure them out. Also, try to make changes to the programs and predict their effects. Then try to create your own sample programs using what you've learnt, and slowly reach your goal.