Open Notepad and type the following:-
public class ex2
{
public static void main(String [] args)
{
int num;
num=100;
System.out.println("The number is "+num);
}
}
public class ex2
{
public static void main(String [] args)
{
int num;
num=100;
System.out.println("The number is "+num);
}
}
- Save the file in desktop.
- Open cmd in windows or terminal in Linux.
- In windows enter cd desktop
- to compile enter javac <file_name>.java //in this condition this is ex2.
- then enter java <file_name> // to run the bytecode.
No comments:
Post a Comment