• www.uptuexam.com
  • GBTU Results 2014
  • MTU Results 2014
  • UPTU Circulars
  • COP Result 2012,13,14
  • UPTU Previous Papers
  • GATE study material
  • Robotics Projects
Thank you for visiting www.UPTUexam.com " Free download Exam materials, previous year question papers, free ebooks & Providing Important Questions To Do their Exams Well and Totally a FREE SERVICE for all engineering streams (B.Tech)."

Simple Program :- Hello Java Example

Simple Program :- Hello Java Example

In this page, we will learn how to write the hello java program. Creating hello java example is too easy. Here, we have created a class named Simple that contains only main method and prints a message hello java. It is the simple program of java.

Requirement for Hello Java Example

For executing any java program, you need to
  • create the java program.
  • install the JDK if you don't have installed it, download the JDK and install it.
  • set path of the bin directory under jdk.
  • compile and execute the program.

Syntax of defining a class –

class Identifier
                                             Members definition



  1. First letter of each word of a class name is capitalized.


  1. In case of methods first letter of each word except the first word is capitalized.

·                  Functions (in C or C++) represents an operation which can be independent whereas methods represents behavior which cannot be independent.

Functions (Task)
Methods (Behaviour)
deposit( )
What is happening
Way of doing things
What is happening
Who is doing.

Question : Why in Java’s main method return type void is used?

Figure 1 is compiler-based program which directly calls O/S functions during execution. So, here O/S returns some integer value to acknowledge that whether the application run successfully or not.

Figure 2 is interpreter-based program which is executed by JRE. Java application has no direct connectivity with O/S. It runs on JRE.

It is JRE who confirms that all byte codes are valid and do not violate Java’s security restrictions. Any type of rule violation led to error(Compile time or runtime) by JRE.

Since JRE is boss of everything and itself capable to handle each type of error, it doesn’t expect anything to come back from main(), so we use void in main() method.

No comments:

Post a Comment