public void test(int x)
{
int odd = 1;
if(odd) // if i write odd==1 it works but i have used this in C a number of times.
{
System.out.println("odd");
}
else
{
System.out.println("even");//output compilation error
}
}
Printable View
public void test(int x)
{
int odd = 1;
if(odd) // if i write odd==1 it works but i have used this in C a number of times.
{
System.out.println("odd");
}
else
{
System.out.println("even");//output compilation error
}
}
This is a double post of an already active question: http://www.javaprogrammingforums.com...html#post71106
If I were a moderator on this forum, I'd close this thread and chastise you for needlessly splitting up a discussion. Perhaps you didn't mean to ask this question in two places? You should probably state in both of these threads which one is the active one so as not to mislead anyone.
ohk sorry my bad!!!!! i was going to ask a different question accidentally copy pasted this one...
When I was a tadpole (on a medium-sized water planet in a galaxy far, far away) the teacher made us write things 100 times on our (underwater) blackboard.
With modern Earth technology, it is a little easier:
Code java:
Output:
In spite of some syntactical similarity: Java is not C. Lots of stuff that works in C is totally bogus Java!
In spite of some syntactical similarity: Java is not C. Lots of stuff that works in C is totally bogus Java!
In spite of some syntactical similarity: Java is not C. Lots of stuff that works in C is totally bogus Java!
.
.
.
Bottom line (in case you missed it): Java is not C.
And, while you are at it, try to imagine how a tadpole can write anything. (Ouch!)
School was a lot tougher way back when.
Cheers!
Z