Detailed Print – CSKC
Sign In

Search

siteicon
Code Learning#JAVA#3791 Back

“Good to see you” Introductory object based modular program

An introductory program to show object based procedure call capability of Java Program.

Learning Objectives

  • A sample to show how java programming is different and is class object and method call based.

Source Code

		 

Click to open popup

Code Understanding

class Intro
{
void display()
{
System.out.println(“Good to see you.”);
}
public static void main(String[] args)
{
Intro ob=new Intro();
ob.display();
}
}

Notes

class Intro
Every program must in a class envelope.
{

void display()
A class contains functional methods or modules
{

System.out.println(“Good to see you.”);
A method called more methods with given arguments.
}
public static void main(String[] args)
A class with main method is called first which is the starting point of program execution process.
{

Intro ob=new Intro(); 
Before any method/module/procedure is used, its place in memory known as object is created.

ob.display();
Method of given object is called.
}
}


Suggested Filename(s): Intro.java