Share on Google+Share on Google+

First Java Program Example

In this section we will discuss about the first java program example.

First Java Program Example

In this section we will discuss about the first java program example.

To create a Java program we would be required to create a Java class. In this class we will print a string like "IIT Mumbai". To demonstrate about a Java program I am giving a simple example.


Here I am giving a simple example which will demonstrate you about how to write your first program in Java. In this example I have created a simple class named In side this class created a method named displayDetails() which will print the string "IIT Mumbai" on call. This class also contained a public static main method inside which Instantiate the class and called the method displayDetails().

Source Code

public class College
    String str = "IIT Mumbai";

    public void displayDetails()
    public static void main(String args[])
          College college = new College();


Download Source Code



Posted on: December 31, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: First Java Program Example  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
April 28, 2013
create a class called college.

how to create a class called 'college'. 1. create an instance of 'college' called 'cosmopoint' 2. create a default constructor for 'college' 3. create a destructor for 'college' I didn't know how to create it. can you help me?