Skip to main content

Unit-1 Java Fundamental

1.1 Introduction to Java

Java is a high-level, object-oriented, general-purpose programming language developed by Sun Microsystems. It is simple, efficient, and platform-independent. Java was originally designed for embedded network applications running on multiple platforms. It is a portable, object-oriented, and interpreted language. 

History of Java

  1. James Gosling (known as the Father of Java), Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. This small team of Sun Microsystems engineers was called the Green Team.

  2. Initially, Java was designed for small embedded systems and electronic appliances such as set-top boxes.

  3. The language was first called Greentalk by James Gosling, and its file extension was .gt.

  4. Later, it was renamed Oak and was developed as part of the Green Project. The oak tree symbolizes strength and is the national tree of several countries, including the United States, France, Germany, and Romania.

  5. In 1995, Oak was renamed Java. The name "Java" was inspired by Java coffee, which comes from the Indonesian island of Java. According to popular accounts, James Gosling chose the name while having a cup of coffee near his office.

  6. JDK 1.0 was released on January 23, 1996. Since its first release, many new features have been added to Java. Today, Java is widely used for developing desktop applications, web applications, enterprise applications, mobile applications, smart cards, embedded systems, and cloud-based applications.

 

 Basic Structure Of Java Program

 

// 1. Package Declaration (optional)

package mypackage;

 

// 2. Import Statements (optional)

import java.util.Scanner;

 

// 3. Class Declaration

public class MyProgram {

 

    // 4. Main Method – Entry point of the program

    public static void main(String[] args) {

 

        // 5. Statements – Code to be executed

        System.out.println("Hello, World!");

    }

}

 

1. Package Declaration (Optional)

A Java program may begin with a package declaration that defines the folder or package name in which the class is stored.
For example: package mypackage;
This helps organize code into different logical groups.

 

2. Import Statements (Optional)

After the package declaration, import statements can be added to include built-in or user-defined Java classes and packages.
For example: import java.util.Scanner;
This allows the program to use various functionalities provided by external classes.

 

3. Class Declaration

Every Java program must have at least one class, which is the main building block of Java code.
For example: public class MyProgram { }
The class name should match the filename, and it contains all the methods and variables of the program.

 

4. Main Method Declaration

Inside the class, the main method is defined using the line:
public static void main(String[] args)
This is the entry point of every Java application, and the JVM starts executing the program from this method.

 

5. Statements (Code Body)

Inside the main method, we write statements that define the program's behavior, such as printing output, taking input, or performing calculations.
For example: System.out.println("Hello, World!");
These statements are executed in the order they appear.

Comments

Popular posts from this blog

Unit-1 Introduction to C#.NET (Class 12)

  What is .NET Framework? The .NET Framework is a software development platform developed by Microsoft. It provides tools and libraries to build and run Windows applications, web services, and web apps. It gives tools and libraries that make it easier to write programs. It also helps the computer run those programs safely and efficiently. Microsoft started working on .NET Framework in the late 1990s . The first version, .NET Framework 1.0 , was released in 2002 .   The .NET Framework is made up of several important components: 1.       Common Language Runtime (CLR) is the core engine that runs your program. It converts your code into machine code that the computer can understand, manages memory, handles errors, and ensures that your program runs safely. 2.       The Class Library is a large collection of ready-made code that helps you perform common tasks like working with files, databases, graphics, the i...