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

Module 2 Subtopic 1 Basic Structure of A Java Program

The document discusses the basic structure of a Java program. It explains that a Java program must be defined within a class, with a public static void main method as the program entry point. This main method calls other methods like System.out.println to display output. The class declaration, access modifiers like public and static, return types like void, and built-in classes like System that provide useful methods are described as fundamental aspects of the basic structure of any Java program.

Uploaded by

jilo tulok
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Module 2 Subtopic 1 Basic Structure of A Java Program

The document discusses the basic structure of a Java program. It explains that a Java program must be defined within a class, with a public static void main method as the program entry point. This main method calls other methods like System.out.println to display output. The class declaration, access modifiers like public and static, return types like void, and built-in classes like System that provide useful methods are described as fundamental aspects of the basic structure of any Java program.

Uploaded by

jilo tulok
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Object Oriented Programming

(Java)
Module 2
Fundamentals of Java Language
Basic Structure of a Java Program

2.1

Fundamentals of Java Language


• Learn the basic syntax and language rules of Java.
BASIC STRUCTURE OF A JAVA CLASS

class HelloWorld{
public static void main(String args[ ]){
System.out.println(“Hello World”);
}
}

class HelloWorld – defines a class, a


template for an object of derived type
HelloWorld

Fundamentals of Java Language


BASIC STRUCTURE OF A JAVA CLASS

class HelloWorld{
public static void main(String args[ ]){
System.out.println(“Hello World”);
}
}

public – access specifier/modifier, the main


method is declared public so that it is
accessible as part of the public interface of
the program.

Fundamentals of Java Language


BASIC STRUCTURE OF A JAVA CLASS

class HelloWorld{
public static void main(String args[ ]){
System.out.println(“Hello World”);
}
}

static – state of the method, it is static


because it must be called before the class
that hosts the method is instantiated

Fundamentals of Java Language


BASIC STRUCTURE OF A JAVA CLASS

class HelloWorld{
public static void main(String args[ ]){
System.out.println(“Hello World”);
}
}

void – It returns void because the Java


interpreter does not expect to receive or
process any output from the class.

Fundamentals of Java Language


BASIC STRUCTURE OF A JAVA CLASS

class HelloWorld{
public static void main(String args[ ]){
System.out.println(“Hello World”);
}
}

System.out.println( ) – The println method


is one of dozens of methods in the System
class. The System class is a part of the core
Java language package of the Application
Programming Interface (API)

Fundamentals of Java Language


Backiel, A. (2015). Beginning Java Programming: The Object-oriented Approach. 1st Edition
Fain, Y. (2015). Java programming 24-hour trainer. John Wiley and Sons:Indianapolis, IN
Smith, J. (2015). Java programs to accompany Programming logic and design. Cengage Learning:Boston, MA
Yener, M (2015). Professional Java EE Design Patterns. John Wiley & Sons, Inc.
Gordon, S. (2017). Computer Graphics Programming in opengl with Java. Mercury Learning and Information
Butler, A (2017). Java. s.n
Lowe, D (2017). Java all-in-one for dummies. John Wiley and Sons
Saumont, P (2017). Functional Programming in Java: How Functional Techniques Improve Your Java Programs. 1st Edition
Heffelfinger, D. (2017). Java EE 8 Application Development. Packt Puublishing
Murach, J. (2017). Murach’s Java Programming. Mike Murach & Associates,Inc.
Burd, B. (2017). Beginning programming with Java for dummies. John Wiley & Sons, Inc.
Manelli, L. (2017). Developing java web application in a day. s.n.
Klausen, P. (2017). Java 5: Files and Java IO software development (e-book)
Klausen, P. (2017). Java 3 object-oriented programming software development (e-book)
Muller, M (2018). Practical JSF in Java EE 8. Apress

You might also like