First: Java Program Syntax

First Programs – Creating your first program …

1st. Create a folder “Java2019_PX” in your Documents folder.
2nd. Create a folder “Unit1” in your “Java2019_PX” folder.
3rd. Create a google doc “JavaIntroNotes_YI” in your drive and share it with gracielaelia@pps.princetonk12.org.
4th. Back up your work to the drive of your choice or use edmodo.com Backpack feature.

First Programs – Ex 1- 5 Basic Java Programs

1. Write a program TenHelloWorlds.java that prints “Hello, World” ten times.

2. Describe what happens if, in HelloWorld.java, you omit
public
static
void
args

3. Describe what happens if, in HelloWorld.java, you omit

a. the ;
b. the first ”
c. the second ”
d. the first {
e. the second {
f. the first }
g. the second }

4. Describe what happens if you try to execute Hi.java with:
Hi.java:

public static void main(String [] args)
{
System.out.println(“Hello ” + args0);
}

In terminal or BlueJ
Run these lines in terminal/command line.

java Hi
java Hi @!&^%
java Hi 1234
java Hi.class Bob
java Hi.java Bob
java Hi Alice Bob

5. Modify UseArgument.java to make a program UseThree.java that takes three names and prints out a proper sentence with the names in the reverse of the order given, so that for example, “java UseThree Alice Bob Carol” gives “Hi Carol, Bob, and Alice.”.

Please take notes and share your document with me.
Use mrseliaphs@gmail.com to share your notes.
If you need/want to email me for any reason, use gracielaelia@princetonk12.org

edmodo.com – First Programs – Ex 1- 5 Basic Java Programs