[Go to site: main page, start]

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

Java Springboot Complete Beginner Notes

Uploaded by

gopi.charan006
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 views13 pages

Java Springboot Complete Beginner Notes

Uploaded by

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

Complete Beginner Notes: Java → Spring Boot

Roadmap

This document is designed for beginners who want to become Java Developers. It explains each phase of
the Java learning roadmap with simple explanations and examples. Follow the phases in order and
practice the examples while learning.
Phase 1 – Core Java Fundamentals

Java Platform
Java is a programming language used to build web applications, enterprise software, mobile apps and
more.

• JDK – Java Development Kit used to develop Java programs

• JRE – Java Runtime Environment used to run Java programs

• JVM – Java Virtual Machine executes Java bytecode

public class HelloWorld {


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

Variables and Data Types


Variables store data. Java has primitive data types that represent simple values.

• int – stores integer numbers

• double – stores decimal numbers

• char – stores characters

• boolean – true or false values

int age = 22;


double salary = 25000.50;
char grade = 'A';
boolean active = true;

Control Statements
Control statements help control the flow of the program using decisions and loops.

• if statement – decision making

• switch statement – multiple choices

• for loop – repeat fixed number of times

• while loop – repeat until condition is false

int number = 10;

if(number > 5){


[Link]("Greater than 5");
}
for(int i=1;i<=3;i++){
[Link](i);
}

Methods
A method is a block of code used to perform a specific task.

public static int add(int a,int b){


return a + b;
}

Arrays
Arrays store multiple values of the same type in a single variable.

int[] numbers = {10,20,30};

for(int n : numbers){
[Link](n);
}
Phase 2 – Object Oriented Programming

Classes and Objects


A class is a blueprint for creating objects. Objects represent real-world entities.

class Student{
String name;
int age;
}

Student s1 = new Student();


[Link] = "Ravi";
[Link] = 21;

Encapsulation
Encapsulation protects data by making variables private and providing getter and setter methods.

class Account{
private int balance;

public void setBalance(int b){


balance = b;
}

public int getBalance(){


return balance;
}
}

Inheritance
Inheritance allows one class to reuse properties and behavior of another class.

class Animal{
void sound(){
[Link]("Animal sound");
}
}

class Dog extends Animal{


}

Polymorphism
Polymorphism means one method behaving differently based on the object.

class Animal{
void sound(){
[Link]("Animal sound");
}
}

class Dog extends Animal{


void sound(){
[Link]("Bark");
}
}

Interfaces
Interfaces define methods that classes must implement.

interface Vehicle{
void start();
}

class Car implements Vehicle{


public void start(){
[Link]("Car started");
}
}
Phase 3 – Important Core Java Concepts

Strings
Strings represent text data in Java.

String name = "Java";


[Link]([Link]());

Exception Handling
Exceptions help handle runtime errors without crashing the program.

try{
int a = 10/0;
}catch(Exception e){
[Link]("Error occurred");
}

Wrapper Classes
Wrapper classes convert primitive types into objects.

int num = 10;


Integer obj = [Link](num);
Phase 4 – Collections Framework

ArrayList
ArrayList is a dynamic array used to store elements.

ArrayList<String> list = new ArrayList<>();


[Link]("Java");
[Link]("Spring");

HashSet
HashSet stores unique elements.

HashSet<Integer> set = new HashSet<>();


[Link](10);
[Link](10);
[Link](20);

HashMap
HashMap stores key-value pairs.

HashMap<Integer,String> map = new HashMap<>();


[Link](1,"Ravi");
[Link](2,"Rahul");
Phase 5 – Java 8 Features

Lambda Expressions
Lambda expressions allow shorter implementation of functional interfaces.

Runnable r = () -> {
[Link]("Thread running");
};

Stream API
Streams allow processing collections in a functional style.

[Link]()
.filter(x -> [Link]("J"))
.forEach([Link]::println);
Phase 6 – SQL Basics

Creating Tables
Tables store structured data in relational databases.

CREATE TABLE students(


id INT,
name VARCHAR(50)
);

CRUD Operations
CRUD stands for Create, Read, Update, Delete operations.

INSERT INTO students VALUES(1,'Ravi');


SELECT * FROM students;
UPDATE students SET name='Rahul' WHERE id=1;
DELETE FROM students WHERE id=1;
Phase 7 – JDBC

JDBC Connection
JDBC allows Java applications to connect to relational databases.

Connection con = [Link](


"jdbc:mysql://localhost:3306/test","root","password");

Executing Queries
PreparedStatement helps execute parameterized SQL queries.

PreparedStatement ps =
[Link]("SELECT * FROM students");
Phase 8 – Web Basics

HTTP
HTTP is the communication protocol between client and server.

• GET – retrieve data

• POST – create data

• PUT – update data

• DELETE – delete data

JSON
JSON is a data format commonly used in APIs.

{
"id":1,
"name":"Ravi"
}
Phase 9 – Spring Framework Basics

Dependency Injection
Spring automatically provides objects to classes instead of manually creating them.

IOC Container
The Inversion of Control container manages object lifecycle.
Phase 10 – Spring Boot

Spring Boot Overview


Spring Boot simplifies building Java web applications with minimal configuration.

REST Controller Example


Spring Boot uses annotations to create REST APIs.

@RestController
public class HelloController{

@GetMapping("/hello")
public String hello(){
return "Hello Spring Boot";
}
}

Entity Mapping
Entities represent database tables in Spring Boot.

@Entity
class Student{

@Id
int id;
String name;

You might also like