Java Programming Lab
1. Write a java program to print a message "Hello World" // Java Program to print "Hello World" message Program Sample.java import java.io.*; class Sample { public static void main(String[] args) { System.out.println("Hello World"); } } 1. Save the file name with Sample with an extension .java. i.e., Sample.java 2. Compile the program with the command javac. javac Sample.java 3. Then the java compiler translates the source code into byte code which is understandable by the JVM. 4. After compilation process, you get the .class with the class name defined in your java program. 5. In the above program you have only one class Sample so, Sample.class file created after compilation process. 6. Execute the java program with the command java. 7. java Sample then it executes the java program. Here, you should give the class name which has main(). Output: 2. Write a java program to perform addition of two numbers Program Addition.java //java program to add...