0% found this document useful (0 votes)
13 views2 pages

Java Program Keywords Explained

basic java notes

Uploaded by

oxfordmeera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Java Program Keywords Explained

basic java notes

Uploaded by

oxfordmeera
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Keywords explained

1. public:
1. Meaning: This keyword is an access modifier, indicating that the
class or method can be accessed from anywhere.
2. In "Hello World": The HelloWorld class is declared public so it
can be seen and used by other parts of your program or by the Java
Virtual Machine (JVM) when it's time to run the program.
The main method is also public, allowing the JVM to invoke it
from outside the class to start the program execution.
2. class:
1. Meaning: Used to define a class, which acts as a blueprint or
template for creating objects.
2. In "Hello World": class HelloWorld defines a class
named HelloWorld where the program's code is encapsulated. All
Java code must reside within a class.
3. static:
1. Meaning: Indicates that a method or variable belongs to the class
itself rather than to an instance of the class. Static members can be
accessed directly using the class name, without the need to create
an object of the class.
2. In "Hello World": The main method is declared static so the JVM
can call it without having to create an object of
the HelloWorld class. This is essential because the main method is
the entry point, and at the start of a program, no objects have been
created yet.
4. void:
1. Meaning: Specifies that a method does not return any value.
2. In "Hello World": The main method is declared void because it is
the program's starting point and does not return any data to the
JVM when it completes its execution.
5. main:
1. Meaning: The specific name Java Virtual Machine (JVM) looks for
when starting a standalone Java program.
2. In "Hello World": main is the name of the method where the
program's execution begins. It's a standard convention that the
JVM recognizes.
6. String[]:
1. Meaning: Declares a parameter as an array of String objects,
according to Naukri.com. String is a predefined class in Java
representing a sequence of characters.
2. In "Hello World": String[] args allows the main method to receive
command-line arguments as an array of strings. Even if no
arguments are passed, this parameter is a required part of
the main method's signature.
7. args:
1. Meaning: The conventional name for the String array parameter of
the main method that holds the command-line arguments.
2. In "Hello World": When you run the program from the command
line and pass arguments, they will be stored in this args array.
8. System:
1. Meaning: A final class in the java.lang package that provides
access to system resources, including standard input, output, and
error streams.
2. In "Hello World": System refers to this built-in class, providing the
standard output stream for printing messages.
9. out:
1. Meaning: A static member of the System class that represents the
standard output stream. It is an instance of the PrintStream class.
2. In "Hello World": out is the object that allows you to send output
(like "Hello, World!") to the console.
10.println():
1. Meaning: A method of the Print Stream class used to print an
argument to the console and then append a newline character.
2. In "Hello World": println("Hello, World!") prints the string "Hello,
World!" to the console and then moves the cursor to the next line,
preparing for any subsequent output.

You might also like