I have the following code:
/* Demonstrate the if.
Call this file IfDemo.java. */
package ifdemo;
public static void main(String args[}) {
int a,b,c;{
a=2;
b=3;
if (a<b) System.out.println("A is less than B");
//this won't display anything if (a==b) System.out.println("You won't see this")
System.out.println();
c=a-b; // C contains -1
System.out.println("C contains -1");
if (C >= 0) system.out.println("C is non-negative");
if (C < 0) system.out.println("C is negative");
System.out.println();
C=b-a; //C contains 1
System.out.println("C contains 1");
if (C >=0)System.out.println("C is non-negative");
if (C<0)System.out.println("C is negative");
}}
At the line: public static void main(String args[} ) { I get three errors: 1.Syntax error on token "void" , @ expected 2.Syntax error on tokens, classheader expected instead 3.Syntax error on tokens, misplaced constructs
I hope you guys can help me out.
Thanks in advance.
if (c >= 0)etc. Also encapsulate the code in a class