Learn coding with amol

PART= 13 Java

hello my name is amol sharma or vineet and this is my 13th part of learn coding with amol and in this part we are going JAVA basics to advance

Java Complete Tutorial

☕ Java Complete Tutorial (Zero → Advanced)

1. Java Introduction

Java is a high-level, object-oriented, platform-independent programming language.

2. Hello World

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

3. Variables & Data Types

int a=10;
double d=5.5;
char c='A';
boolean b=true;
String name="Java";

4. Operators

int x=10,y=3;
System.out.println(x+y);
System.out.println(x-y);
System.out.println(x*y);
System.out.println(x/y);

5. If Else

int age=18;
if(age>=18)
 System.out.println("Adult");
else
 System.out.println("Minor");

6. Loops

for(int i=1;i<=5;i++)
 System.out.println(i);

7. Arrays

int[] arr={1,2,3};
for(int i:arr)
 System.out.println(i);

8. Methods

static int add(int a,int b){
 return a+b;
}

9. OOP – Class & Object

class Car{
 String name="BMW";
 void run(){
  System.out.println("Running");
 }
}

10. Inheritance

class A{
 void show(){System.out.println("A");}
}
class B extends A{
 void show(){System.out.println("B");}
}

11. Polymorphism

A obj=new B();
obj.show();

12. Encapsulation

class User{
 private String name;
 public void setName(String n){name=n;}
 public String getName(){return name;}
}

13. Abstraction

abstract class Shape{
 abstract void draw();
}
class Circle extends Shape{
 void draw(){System.out.println("Circle");}
}

14. Interface

interface A{
 void run();
}
class B implements A{
 public void run(){System.out.println("Running");}
}

15. Exception Handling

try{
 int a=10/0;
}catch(Exception e){
 System.out.println("Error");
}

16. Strings

String s="Java";
System.out.println(s.length());

17. Collections

import java.util.*;
ArrayList list=new ArrayList<>();
list.add(10);
list.add(20);

18. Multithreading

class MyThread extends Thread{
 public void run(){
  System.out.println("Thread Running");
 }
}

19. File Handling

import java.io.*;
FileWriter fw=new FileWriter("a.txt");
fw.write("Hello");
fw.close();

20. JDBC

import java.sql.*;
Connection con=DriverManager.getConnection(
"jdbc:mysql://localhost/test","root","");

21. Java 8 Lambda

list.forEach(n->System.out.println(n));

✅ Java Covered Completely

Core Java + Advanced Java done.

Report a Bug

🐞 Report a Bug

OR

Comments

Post a Comment

Popular posts from this blog

Learn coding with amol

Learn coding with amol

Learn coding with amol