0% found this document useful (0 votes)
8 views2 pages

Java Basics Lesson 1

This document introduces Java as a high-level, object-oriented programming language and provides instructions for installing the Java Development Kit (JDK). It includes a simple Java program example, explanations of basic data types, and a user input example using the Scanner class. Additionally, it suggests practice tasks for beginners to reinforce learning.

Uploaded by

nelfannaveen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Java Basics Lesson 1

This document introduces Java as a high-level, object-oriented programming language and provides instructions for installing the Java Development Kit (JDK). It includes a simple Java program example, explanations of basic data types, and a user input example using the Scanner class. Additionally, it suggests practice tasks for beginners to reinforce learning.

Uploaded by

nelfannaveen
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JAVA BASICS - LESSON 1 (From Scratch)

1. What is Java?

Java is a high-level, object-oriented programming language used to build web applications, mobile
apps, desktop software, and enterprise systems.

2. Install Java (JDK)

To start coding in Java, you must install the JDK (Java Development Kit). After installing, verify
using command: javac -version

3. First Java Program

public class Main {


public static void main(String[] args) {
[Link]("Hello, World!");
}
}

Explanation: public class Main → Class name main() → Starting point of program
[Link]() → Prints output to screen

4. Variables in Java

int age = 20;


double salary = 25000.50;
char grade = 'A';
boolean isPassed = true;
String name = "Mohith";

5. Basic Data Types

• int → Whole numbers

• double → Decimal numbers

• char → Single character


• boolean → true/false

• String → Text

6. User Input Example

import [Link];

public class Main {


public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter your name: ");
String name = [Link]();
[Link]("Hello " + name);
}
}

Practice Tasks

• Print your name and age.

• Create variables for 3 subjects and print total marks.

• Take user input and print square of a number.

End of Lesson 1. Practice daily. Brick by brick.

You might also like