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

Java Programming Basics and Examples

Uploaded by

bojog83332
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)
5 views2 pages

Java Programming Basics and Examples

Uploaded by

bojog83332
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 Notes (Simple + Examples)

1. Java kya hai?

- Java ek programming language hai.

- Ye Object Oriented Programming (OOP) par based hai.

- Java ka code har device par chal sakta hai (Write Once, Run Anywhere).

2. Java Program ka Basic Structure:

public class Main {

public static void main(String[] args) {

[Link]("Hello Jony!");

3. Variables:

int age = 18;

String name = "Jony";

float marks = 92.5f;

4. Input using Scanner:

import [Link];

Scanner sc = new Scanner([Link]);

int age = [Link]();

5. If-Else:

int age = 18;

if(age >= 18){

[Link]("Adult");

} else {

[Link]("Minor");

}
6. Loops:

for(int i=1; i<=5; i++){

[Link](i);

7. Methods:

public static void greet() {

[Link]("Hello Jony!");

8. OOP Example:

class Student {

String name;

int age;

void study(){

[Link](name + " is studying");

You might also like