This Java file contains the classic Hello World program in Java. Try tinkering with the code in the following ways to see what happens.
- Change the class from
HelloWorldtohelloworld. Recompile. What happens? Change it back. 2.It gives an error - In the line containing
System.out.println("Hello, world!");, try leaving out a quotation mark or the semi-colon. Recompile. What happens? Change it back. 3.It gives an error - Try manipulating the "Hello, World!" String to say something else. Recompile.
4.
The output chamges - Based on your knowledge of programming, add the following line before the
System.out.println().String name = "Sam";Try to get the line to print out what the value ofnameis. Notice that in Java, we need to declare the types of variables. 6.The output changes to sam