Loading
Publish On: 2019-03-22

Guy white

Total Post: 819

Question: what are Java programs

Reply On: 2013-10-20

Computer Science

Total Post: 1

ANS: what are Java programs

Java programs are called java Classes. A java program file contains at least one java class. A java class begins with the name of the class following by two curly brackets-one opening {“and one closing curly bracket”}. “All the logic or functionality that exists in a java program is contained within the ugly brackets of a java class. Statements in java are terminated by a semicolon. You can write more than one statement on one line.

For example: if one wishes to write to write a program called Apple which prints “I’m a fruit”, the syntax to do would be

Public class Apple {

          Public static void main(String args[]) {

System.out. println (“I’ m a fuit”) ;

      }

}

The above program just outputs a line of text to the command line. We won’t worry about how the program runs at the moments. We will see what classes are and the syntax in detail in later units.

When you save this file, it will be called as Apple.java. The.java extension tells us that this is the source code (high level language code). It is a good practice to save all your source code in a new directory rather than in the C:jdk 1.5.0 directory.

Submit Your Answer

warning: Please Login To Submit Your Answer
Like Us On Facebook for All Latest Updates