You are on page 1of 12

1

Hello World!!!
JAVA FUNDAMENTALS

Hello World Java is very EASY

int size =12;

Declare an integer variable named size and give it a value 12

String color= Brown;

Declare a string variable named color and give it a value Brown

x = size 5;

Subtract 5 from 12 (value of size) and assign it to a variable called x

Shoe myShoe = new Shoe(color, size)

Declare a Shoe variable myShoe and make a new Shoe using color and size

If (x < 20) myShoe.run(5);

If the x is less than 20, tell the shoe run for 5 miles.

While ( x > 8) {

As long as x is greater than 8, tell the shoe to jog.

myShoe.jogg();
}

Int[] numList = {1,3,5,7,9};

Declare a list of integers variable numList and put 1,3,5,7,9 values in to list.

System.out.println(Hello);

Print out Hello on to the command line.

System.out.println(Shoe color: + color);

Print out Shoe color: Brown to the command line.

How Java Works?

What youll do in Java

Java Program

Hello World

Let us write Java Source Code HelloWorld.java

Let us compile the Java Source Code in to HelloWorld.class

We will run the program by launching a JVM

We will see the output of your first ever HelloWorld Program

Command Line

Demo Time

Java Program

Hello World2

HelloWorld in IDE

Variations of Print functions.

Demo Time

Best Practice Recommendations

Comments

Purpose

Author

Date and Time when program was last modified

Use Blank lines & Spaces to enhance Program Readability

Indent code and match curly braces.

Avoid Syntax Errors

10

Quiz Time
Prior to acquiring an official name Java, the
pre-released version of Java was called
__________ language.
Answer :
Oak Programming Language

11

Quiz Time
Who is the father of Java
Programming language

a.
b.
c.
d.
e.

Roy Fielding
James Gosling
Eric Schmidt
Steve Jobs
David Beckham

Answer :
James Gosling

12

Quiz Time
Which of the following
command invokes Java Virtual
Environment?

a.
b.
c.
d.
e.

cmd
javac
java
gedit
System.out.println

Answer :
Java

You might also like