Day 1: Introduction to Java

Goals:

  • Understand the basics of Java and its platform.
  • Set up the development environment.

Topics:

  1. What is Java? Overview and history
    • Java is a high-level, class-based, object-oriented programming language designed to have as few implementation dependencies as possible.
    • Developed by Sun Microsystems in 1995 and later acquired by Oracle Corporation.
    • Java is widely used for building enterprise-scale applications, Android apps, and server-side applications.
  2. Installing Java Development Kit (JDK) and Integrated Development Environment (IDE)
    • Java Development Kit (JDK) Installation:
      • Download the latest JDK from the Oracle website or use an open-source version like AdoptOpenJDK.
      • Follow the installation instructions for your operating system (Windows, macOS, or Linux).
    • Integrated Development Environment (IDE) Installation:
      • Popular IDEs for Java development include IntelliJ IDEA and Eclipse.
      • Download IntelliJ IDEA from JetBrains website or Eclipse from Eclipse website.
      • Follow the installation instructions for your operating system.
  3. Writing your first Java program (“Hello, World!”)
    • Open your IDE and create a new Java project.
    • Create a new Java class with the following code:
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}
  1. Basic syntax and structure of a Java program
    • Class Definition: Every Java program must have at least one class definition.
    • Main Method: The main method is the entry point of any Java program.
    • Statements: Each statement ends with a semicolon (;).
    • System.out.println: This method is used to print text to the console.

Exercises:

  1. Write, compile, and run your first Java program:
    • Write the “Hello, World!” program as shown above.
    • Compile the program:
      • In IntelliJ IDEA, click the green run button.
      • In Eclipse, click the run button.
    • Run the program to see the output.
  2. Experiment with different outputs:
    • Modify the System.out.println line to print different messages.
    • Example:
System.out.println("Welcome to Java programming!");
System.out.println("Java is fun!");
System.out.println("Let's learn more!");

By the end of Day 1, you should have a basic understanding of Java, have your development environment set up, and be able to write and run simple Java programs.

Fycs 4 Abhay Gupta
Fycs 4 Abhay Gupta
Articles: 1