0% found this document useful (0 votes)
23 views

Every Program in Java Must Have A Class. Every Java Program Starts From The Main Method

Java is a high-level programming language designed in the 1990s that runs on many devices. It is platform independent, meaning programs can run on different operating systems, and portable. Every Java program must contain a class with a main method that acts as the starting point. The main method is public, static, returns void, and is where program execution begins.

Uploaded by

Logronio Clent
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Every Program in Java Must Have A Class. Every Java Program Starts From The Main Method

Java is a high-level programming language designed in the 1990s that runs on many devices. It is platform independent, meaning programs can run on different operating systems, and portable. Every Java program must contain a class with a main method that acts as the starting point. The main method is public, static, returns void, and is where program execution begins.

Uploaded by

Logronio Clent
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Java

 Is a high level, modern programming language designed in the early 1990s by Sun Microsystems,
and currently owned by Oracle.
 Is Platform Independent, which means that you only need to write the program once to be able
to run it on several different platforms.
 Java is Portable, robust, and dynamic, with the ability to fit the needs of virtually any type of
application.
 More than 3 billion devices run Java. Used to develop apps for Google’s android OS, various
Desktop Applications, such as media players, antivirus programs, Web Applications, Enterprise
Applications and many more.
 In Java, every line of code that can run needs to be inside a class.
*Every program in Java must have a class.
 In Java, each application has an entry point, or a starting point, which is a method called main
*Every Java program starts from the main method.

The main Method


Method > A collection of statements that are grouped together to perform an operation (also called a
function)

Array > Is a collection of variables of the same type

-Public: anyone can access it


-Static: method can be run without creating an instance of the class containing the main method
-void: method doesn’t return any value
-main: the name of the method

System.out.println()

The println method prints a line of text to the screen. The system method and its out stream are used to
access to println method.

*In classes, methods, and other flow-control structures codes is always enclosed in curly braces “{}”
Semicolons in Java

 In Java, each code statement must end with a semicolon “ ; ”

Remember*
Do not use semicolons after method and class declarations that follow with the body defined using the
curly braces.
Comments

 The purpose of including comments in your code is to explain what the code is doing. Java
supports both single and multi-line comments. All characters that appear within a comment
are ignored by the Java Compiler.
 A single-line comment starts with two forward slashes and continues until it reaches the end
of the line.

Multi-line Comments

You might also like