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.


1. JDK (Java Development Kit)

JDK is a software development kit used to develop, compile, debug, and run Java applications. It includes the JRE, JVM, and development tools such as javac.

Example:

javac Hello.java

The javac compiler (part of the JDK) compiles Hello.java into Hello.class.

2. JRE (Java Runtime Environment)

JRE is a software package that provides the environment needed to run Java applications. It includes the JVM and Java libraries but does not include development tools like javac.

Example:

java Hello

The JRE runs the compiled Java program Hello.class.

3. JVM (Java Virtual Machine)

JVM is a virtual machine that executes Java bytecode (.class files) by converting it into machine code. It also manages memory, garbage collection, and security.

Example:

public class Hello {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

After compilation:

javac Hello.java

Run the program:

java Hello

Here, the JVM executes the Hello.class bytecode and displays:

Hello, World!


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...

Introduction to Software Engineering (Class 12)

 Introduction to Software Engineering Software engineering is the branch of computer science that deals with the design, development, testing, and maintenance of software applications. Software engineers apply engineering principles and knowledge of programming languages to build software solutions for end users. IEEE, in its standard 610.12-1990, defines software engineering as the application of a systematic, disciplined, which is a computable approach for the development, operation, and maintenance of software. Boehm defines software engineering, which involves, ‘the practical application of scientific knowledge to the creative design and building of computer programs. It also includes associated documentation needed for developing, operating, and maintaining them.’ Importance of Software Engineering Reduces complexity Large software systems are divided into smaller, manageable modules. Each module is developed and solved independently, ...

Unit 2 Operating System

  Unit- 2  Process and Process Scheduling 2.1 Introduce Process, Program and Process Life Cycle  Process Process is something that is currently under execution. So, an active program can be called a Process. Examples: ●        Opening a web browser to search something on the internet — the browser becomes a process. ●        Launching a music player to enjoy your favorite tunes — the music player is also a process. In computing, a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity. Modern operating systems support multithreading , meaning a process can have multiple threads running concurrently .   A Process has various attributes associated with it. Some of the attributes of a Process are: ●          Process Id: Every process will be given a unique id that identifies the process...