Java Full Stack 2.0: Introduction To JAVA Day - 1
Java Full Stack 2.0: Introduction To JAVA Day - 1
Java Full Stack 2.0: Introduction To JAVA Day - 1
0
Introduction to JAVA
DAY -1
Hi There....
ABOUT PANTECH?
Educational Equipment Manufacturer | Technical Training | DIY Project
A. IOT
B. PROGRAMMABLE SOLUTION PROVIDER – AI , ML & JAVA
C. AI/ROBOTICS/AUTONOMOUS ROBOT,
MICROPROCESSOR/MICROCONTROLLER
D. DSP,VLSI, EMBEDDED SYSTEM/
E. POWER ELECTRONICS & DRIVES, FUEL CELL TRAINER KIT
F. RENEWABLE ENERGY LAB, ELECTRIC VEHICLE LAB
OUR VISION
Students to
Help 10 Million
Learn the Technology in Easy Way
NANDHINI.S
•5 year of Industry Experience
•Expertise in JAVA , Python and ML Implementations
•Language – Python , Java , HTML ,CSS.
•Tools – ANACONDA NAVIGATOR, JUPYTER NOTEBOOK
•GOOGLE COLAB.
WHAT IS MASTER CLASS ?
👍This is the 30 Days Industrial Learning Activity.
Associate Partner
PARTICIPATION
CERTIFICATE OF
CERTIFICATE PARTICIPATION
25 DAYS YOUR NAME
YOUR COLLEGE NAME
has Successfully Completed
30 DAYS JAVA FULL STACK PROGRAM
at Pantech e Learing Pvt Ltd, Chennai
Director, Pantech
WHAT U WILL
LEARN FROM THIS
MASTERCLASS
JAVA
Introduction To Java and OOPS
Concepts
HTML
Basic elements, Paragraphs,
JAVA FULL Colors, Forms, Input Types
STACK SERVLETS
Introduction, Exceptions,
LEARNING Database Access
Plan 1 -15
OUR AGENDA
Day 16- Servlets – Server Response , Http Codes , Writing Filters
Day 17- Servlets – Exceptions , Cookies Handling , Session Tracking
Day 18- Servlets – Database Access, File Uploading , Handling Date.
Day 19- MySQL – Introduction, Installation, Create Database, Drop database.
Day 20- MySQL – Data Types , Create Tables, Drop Tables, Insert Query
Day 21-MySQL – Select Query , Where Clause, Update Query , Delete Query, Like
Clause , Sorting Results , Using Join.
Day 22-Introduction To JDBC, Jdbc Components , Driver Connections.
Day 23-JDBC Examples.
Day 24-JDBC Transactions.
Day 25- Erasure Coding
Day 26-Public Auditing
Day 27-Counselling Management System
Plan 16 - 30
Day 30 -Secure Multi-Owner Data Sharing.
OUR AGENDA
1. Erasure Coding(Day 25)
2. Public Auditing(Day 26)
List of Projects for 3. Counselling Management System(Day 27)
Demo in YouTube 4. Software Puzzle(Day 28)
5. Crime Management System(Day 29)
Live 6. Secure Multi-Owner Data Sharing(Day 30)
Memory – Management:
Java provides its own mechanism for managing the memory is known as
garbage collection.
It automatically deletes the objects when they no longer used by the
application. It improves the speed of the application.
REASONS TO LEARN JAVA
It is one of the hottest programming languages in today’s world.
Millions of applications can be built with Java Programming Language.
Java is used in a variety of industries like tech , government , finance ,
healthcare , insurance , education and more.
The entry-level salary of a Java Developer is $59,053. With more
experience , the salary can exceed $100,000.
So, Java developers make more money.
COMPONENTS OF JAVA
JVM: It provides an environment for executing Java
Programs.
JDK: It is a software development environment and it contains
the compiler , debugger and other classes to compile and debug
a software program.
JRE: It provides a runtime environment to execute the Java
programs and other applications.
APPLICATIONS OF JAVA:
Mobile App Development:
Most of the android applications build using Java.
The most popular android app development IDE Android
Studio also uses Java for developing android applications.
APPLICATIONS OF JAVA:
Desktop GUI Applications:
We can also develop a GUI application using Java.
Java provides AWT, JavaFX, and Swing for
developing the GUI based desktop application.
APPLICATIONS OF JAVA:
Web - Based Applications
It is also used for developing the web-based application
because it provides vast support for web development
through Servlet, JSP, and Struts.
It is the reason that Java is also known as a server-side
programming language. Using these technologies,
we can develop a variety of applications.
The most popular frameworks Spring, Hibernate, Spring
Boot, used for developing web-based applications.
APPLICATIONS OF JAVA:
Game Development
Java is widely used by game development companies
because it has the support of the open-source most
powerful 3D engine.
The engine provides unparalleled capacity when it
comes to the context of the designing of 3D games.
APPLICATIONS OF JAVA:
Big Data Technology:
The tool Hadoop HDFS platform for processing and storing big
data applications is written in Java.
In big data, Java is widely used in ETL applications such as
Apache Camel and Apache Kafka.
APPLICATIONS OF JAVA:
IOT Application
IoT is a technology that connects the devices in its network
and communicates with them.
IoT has found almost in all the small devices such as health
gears, smartphones, wearables, smart lighting, TVs, etc.
For developing the IoT application there is a lot of programming languages that can be
used but Java offers an edge to developers that is unparalleled.
ECLIPSE AND JDK INSTALLATION
Installation of jdk and adt bundle.
Steps involved in setting the jdk path.
https://imjo.in/gHNkDr
WHAT IS INTERNSHIP ?
OBJECTIVE OF THIS 30 DAYS
MASTER CLASS
PANTECH WILL
MAKE YOU TO
CREATE 6
PROJECTS IN JAVA
IN 30 DAYS
1 MONTH INTERNSHIP IN JAVA
INTERNSHIP E-Certificate (30Days Internship on Java Full Stack)
Highly organized Video content
Download Project Files
Download PPTs
Assignments
Weekly Hackathons
Flexible Time.
Access Period: 60 Days from the date of payment
Community or Forum Support
HOW TO ENROLL INTO
1 MONTH INTERNSHIP?
https://imjo.in/gHNkDr
DAY -3
PREVIOUS SESSION
JAVA IDENTIFIERS
JAVA COMMENTS
}
OUTPUT
John
Drinking milk
EXERCISE
Find the error in the following code.
public class Flower{
public void blossom{
System.out.println(“Flowers blossom);
}
}
Solution:
}
Java Comments(Single Line Comments)
// Example Comment
System.out.println(“My First Comment");
ØAs you can see , in the above example , a comment is included before the code.
ØIn the below example , a comment is included at the end of the code.
}
}
Task:
Exercise:
Write one sample program to illustrate single-line comment.
Find the error in the following program.
*/This is my first multi-line comment gets printed at the output*/ /
System.out.println(“This is my first multi-line comment");
Solution:
public class Commexample{
public static void main(String[] args) {
//Sample Comment
System.out.println(“Welcome to the world of JavaProgramming");
System.out.println(“Learning Java is fun");//End of line Comment
}
}
Correct Code:
/*This is my first multi-line comment gets printed at the output*/
System.out.println(“This is my first multi-line comment");
JAVA DOCUMENTATION COMMENT
/**
*
*We can use various tags to depict the parameter
*or heading or author name
*We can also use HTML tags
*
*/
ARE JAVA COMMENTS EXECUTABLE
if(num1 % 5 == 0)
{
System.out.println("Number is divisible by 5");
}
else
SOLUTION:
{
System.out.println("Number is not divisible by 5");
}
}}
Java if-else-if ladder Statement:
Syntax:
if(condition1){
//code to be executed if condition1 is true
}else if(condition2){
//code to be executed if condition2 is true
}
else if(condition3){
//code to be executed if condition3 is true
}
Java if-else-if ladder Statement:
if(marks<50){
System.out.println("fail");
}
Example:
else if(marks>=50 && marks<60){
System.out.println("D grade");
}
else if(marks>=60 && marks<70){
System.out.println("C grade");
}
Example:
else if(marks>=70 && marks<80){
System.out.println("B grade");
}
else if(marks>=80 && marks<90){
System.out.println("A grade");
}else if(marks>=90 && marks<100){
System.out.println("A+ grade");
}else{
System.out.println("Invalid!");
}
Program to check POSITIVE, NEGATIVE or
ZERO:
public class PositiveNegativeExample {
public static void main(String[] args) {
int number=-13;
if(number>0){
System.out.println("POSITIVE");
}else if(number<0){
System.out.println("NEGATIVE");
}else{
System.out.println("ZERO");
}
}
}
//Java Program to demonstrate the use of Nested If
Statement.
•As the name suggests, the break statement is used to break the
current flow of the program and transfer the control to the next
statement outside a loop or switch statement.
•However, it breaks only the inner loop in the case of the nested
loop.
•The break statement cannot be used independently in the Java
program, i.e., it can only be written inside the loop or switch
statement.
// Continue statement:
switch(choice) {
}
Output:
1
2
3
4
5
Multi-Dimensional Array:
class Multiarrex{
public static void main(String args[]){
//declaring and initializing 2D array
int numarr[][]={{1,2,3},{4,5,6},{7,8,9}};
//printing 2D array
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
System.out.print(numarr[i][j]+" ");
}
System.out.println();
}
}}
Output:
123
456
789
Exercise:
Find the error in the following code:
public class sampArr{
public static void main(String[] args){
int arr1[5] = new arr1[];
arr1[1] = 10;
arr1[2] = 11;
arr1[3] = 12;
arr1[4] = 13;
arr1[5] = 14;
for(int i=0;i<arr1;i++){
System.out.println(arr1[i]);
}}
Correct Code:
public class sampArr{
public static void main(String[] args){
int arr1[] = new int[5];
arr1[0] = 10;
arr1[1] = 11;
arr1[2] = 12;
arr1[3] = 13;
arr1[4] = 14;
for(int i=0;i<arr1.length;i++){
System.out.println(arr1[i]);
}}
Exercise:
Find the error in the following code:
public class sampArr{
public static void main(String[] args){
int arr1[5] = new arr1[];
arr1[1] = 10;
arr1[2] = 11;
arr1[3] = 12;
arr1[4] = 13;
arr1[5] = 14;
for(int i=0;i<arr1;i++){
System.out.println(arr1[i]);
}}
SOLUTION:
public class sampArr{
public static void main(String[] args){
int arr1[] = new arr1[5];
arr1[0] = 10;
arr1[1] = 11;
arr1[2] = 12;
arr1[3] = 13;
arr1[4] = 14;
for(int i=0;i<arr1.length;i++){
System.out.println(arr1[i]);
}}
Methods In Java:
Methods which are manually written by the user are called user-
defined methods.
Example Program:
public class Division
{
public static void main(String[] args)
{
int num1 = 20;
int num2 = 2;
Division d1 = new Division();
int num3 = d1.div(num1,num2);
System.out.println("The division of num1 and num2 is= " + num3);
}
Example Program:
Example:
package mypack;
public class B{
public void msg(){System.out.println("Hello");
}
}
TASK:
Access Modifiers specifies the access level of the fields , methods, classes and constructors.
DEFAULT ACCESS MODIFIERS:
If we do not mention any access modifiers for classes, methods , variables etc , then by default
the default access modifiers are used.
package defaultPackage;
class Logger {
void message(){
System.out.println("This is a message");
}
}
PRIVATE ACCESS MODIFIERS:
When the variables and methods are declared private , they cannot be accessed outside the
class.
PRIVATE ACCESS MODIFIERS:
class Data {
// private variable
private String name;
}
I am an animal.
Public access modifier:
When the methods , variables and classes are declared public , we can access them
from anywhere.
Public access modifier:
// Animal.java file
// public class
public class Animal {
// public variable
public int legCount;
// public method
public void display() {
System.out.println("I am an animal.");
System.out.println("I have " + legCount + " legs.");
}
}
Public access modifier:
// Main.java
public class Main {
public static void main( String[] args ) {
// accessing the public class
Animal animal = new Animal();
I am an animal.
I have 4 legs.
TASK:
Write a program to illustrate the use of private access modifiers.
Java string:
System.out.println(s1.equals(s2));//false
System.out.println(s1.equalsIgnoreCase(s2));//true
}
}
STRING COMPARE BY == OPERATOR
class Teststringcomparison3{
public static void main(String args[]){
String s1="Sachin";
String s2="Sachin";
String s3=new String("Sachin");
System.out.println(s1==s2);//true (because both refer to same instance)
System.out.println(s1==s3);//false(because s3 refers to instance created in
nonpool)
}
}
FILL IN THE MISSING CODE:
class Teststringcomparison3{
public static void main(String args[]){
String s1="Sachin";
String ____="Sachin";
String s3=____ String("Sachin");
System.out.println(s1=______);
System.out.println(s1==s3);
}
}
CORRECT CODE:
class Teststringcomparison3{
public static void main(String args[]){
String s1="Sachin";
String s2="Sachin";
String s3=new String("Sachin");
System.out.println(s1==s2);//true (because both refer to same instance)
System.out.println(s1==s3);//false(because s3 refers to instance created in nonp
ool)
}
}
CORRECT CODE:
class Teststringcomparison3{
public static void main(String args[]){
String s1="Sachin";
String s2="Sachin";
String s3=new String("Sachin");
System.out.println(s1==s2);//true (because both refer to same instance)
System.out.println(s1==s3);//false(because s3 refers to instance created in nonp
ool)
}
}
STRING COMPAREBY COMPARETO
METHOD
The string compareto method compares two string values and returns an
integer value if string1 is greater than, less than or equal to the second
string.
STRING EXAMPLE
class Teststringcomparison4{
public static void main(String args[]){
String s1="Sachin";
String s2="Sachin";
String s3="Ratan";
System.out.println(s1.compareTo(s2));//0
System.out.println(s1.compareTo(s3));//1(because s1>s3)
System.out.println(s3.compareTo(s1));//-1(because s3 < s1 )
}
}
TASK:
Write a program to illustrate the use of compareTo operator
STRING CONCATENATION:
String concatenation is used to combine two strings.
There are two ways to concat strings in Java.
1)By string concatenation(+) operator.
2)By concat() method.
STRING CONCATENATION:
String Concatenation operator(+) is used to add two strings.
class TestStringConcatenation1{
public static void main(String args[]){
String s="Sachin"+" Tendulkar";
System.out.println(s);//Sachin Tendulkar
}
}
FIND THE ERROR IN THE FOLLOWING
CODE:
class TestStringConcatenation1{
public static void main(String args[]){
String s=“Big"" Circle";
Systemout.println(s);
}
Correct code:
class TestStringConcatenation1{
public static void main(String args[]){
String s=“Big"+" Circle";
System.out.println(s);
}
}
STRING CONCATENATION
String concatenation is achieved through stringbuilder or stringbuffer class
and its append method.
class TestStringConcatenation2{
public static void main(String args[]){
String s=10+11+“Simple”+1+1;
System.out.println(s);
}
}
Output:
Beautiful Flower
Task:
1)Write a program to illustrate the use of string concat operator.
Substring in java:
A part of string is called a substring.
Substring is a subset of another string.
Index starts from zero.
Start index is inclusive and end index is exclusive.
You can get the substring from the string object by one of the two methods.
Syntax:
*********
public String substring(int startIndex): This method returns new String object
containing the substring of the given string from specified startIndex (inclusive).
public String substring(int startIndex, int endIndex): This method returns new
String object containing the substring of the given string from specified startIndex to
endIndex.
EXAMPLE:
String s="hello";
System.out.println(s.substring(0,2));//he
Example of java substring:
public class TestSubstring{
public static void main(String args[]){
String s="SachinTendulkar";
System.out.println(s.substring(6));//Tendulkar
System.out.println(s.substring(0,6));//Sachin
}
}
Java string class methods:
The java.lang.String class provides a lot of methods to work on
strings. With the help of these methods,we can perform lot of
operations on strings like concatenating, trimming and comparing
strings.
Everything we submit in a form is treated as a string and so Java
Strings is a powerful concept.
STRING touppercase and tolowercase
methods:
The toUpperCase() method converts the string into uppercase letter and
toLowerCase() method converts the string into lowercase letter.
Example:
String s="State";
System.out.println(s.toUpperCase());
System.out.println(s.toLowerCase());
System.out.println(s);
Output:
STATE
state
State
INHERITANCE:
When a childclass inherits the properties of the parent class , then this
concept is called as inheritance.
INHERITANCE:
Example
class Employee3{
float salary=40000;
}
class Programmer extends Employee3{
int bonus=10000;
public static void main(String args[]){
Programmer p=new Programmer();
System.out.println("Programmer salary is:"+p.salary);
System.out.println("Bonus of Programmer is:"+p.bonus);
}
}
Output:
Parrots are screeching
flying
MULTI-LEVEL INHERITANCE:
class Animal{
void eat(){System.out.println("eating...");}
}
class Dog extends Animal{
void bark(){System.out.println("barking...");}
}
class BabyDog extends Dog{
void weep(){System.out.println("weeping...");}
}
class TestInheritance2{
public static void main(String args[]){
BabyDog d=new BabyDog();
d.weep();
d.bark();
d.eat();
}}
Hierarchical Inheritance:
class Bird{
void fly(){System.out.println("Birds are flying");}
}
class Parrot extends Bird{
void screech(){System.out.println("Parrots are screeching");}
}
When the methods in the child class has the same name as the
methods in the parent class but different method implementations
,then it is called as method overriding..
class Aeroplane{
9
9.0
9.78
9
Exercise:
}}
ABSTRACT CLASS:
Drinking water
Find the Error:
interface Walking{
void walk;
}
interface Slow{
void walk;
}
class TestInterfac1 implements Walking, Slow{
public void walk(){
System.out.println("Hello");
}
public static void main(String args[]){
TestInterfac1 obj = new TestInterfac1();
obj. walk();
}
}
Constructors:
Whenever an object is created , the constructor gets called.
Example Program:
public class Human {
int age;
String name;
Human(int a,String n){
age = a;
name = n;
}
void display(){System.out.println(age+" "+name);}
20 Mala
22 Kala
Exercise:
Write a program to illustrate the use of constructors.
public class Car{
Car(){
System.out.println("New Car");
}
public static void main(String args[]){
Car c = new Car ();
}
}
Instance Variables:
Variables that are declared within the class but outside any method are called
instance variables.
For instance variables , the memory is allocated at runtime rather than at
compile time.
Example Program:
public class Bike {
String Colour;
String name;
}
Output:
Red Pulsar
Driving Bike
ENCAPSULATION:
It is the process of grouping the code and data together as a single unit.
package mypack;
public class Person{
private int age;
public int getAge(){
return age;
}
public void setAge(int age){
this.age = age ;
}
}
package mypack;
class Test{
public static void main(String[] args){
Person s=new Person();
s.setAge(30);
System.out.println(s.getAge());
Output:
30
Wrapper Classes in Java:
A wrapper class is used to convert the primitive datatypes into object type and
object type into primitive type.
Example:
public class WrapperExample1{
public static void main(String args[]){
int a=10;
Integer i=Integer.valueOf(a);
Integer j=a;
Matcher Class:
•A Matcher object is an engine that interprets the pattern and performs match
operation against an input string.
Regular Expression - Introduction:
Matcher Class:
• A Matcher object is obtained by invoking a matcher() method on a
Pattern object.
Regular Expression - Introduction:
•Capturing Groups: They are a way to treat multiple characters as a single unit.
•They are created by placing the characters to be grouped inside a set of
parentheses.
•The regular expression (dog) creates a single group containing the letters “d”, “o”
and “g”.
•Consider the following example.
• There are four such groups:
((A)(B(C)))
(A)
(B(C))
(C)
Capturing Groups:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
while(m.find()) {
count++;
System.out.println("Match number "+count);
System.out.println("start(): "+m.start());
System.out.println("end(): "+m.end());
}
}
}
Output:
Match number 1
start(): 0
end(): 3
Match number 2
start(): 4
end(): 7
The Start And End Methods:
The above example uses word boundaries to ensure that the letters “c”
“a” “t” are not merely a substring in a longer word.
It also gives some information about where in the input string the match
has occurred.
The start method returns the start index of the subsequence captured by
the given group during the previous match operation.
The end returns the index of the last character matched , plus one.
The Matches and lookingAt Methods:
System.out.println("lookingAt(): "+matcher.lookingAt());
System.out.println("matches(): "+matcher.matches());
}
}
Output:
Current REGEX is: foo
Current INPUT is: fooooooooooooooooo
lookingAt(): true
matches(): false
The replaceFirst and replaceAll Methods:
The replaceFirst and replaceAll methods replace the text that matches a given regular
expression.
•As their names indicate , replaceFirst replaces the first occurrence and replaceAll
replaces all occurences.
•Example:
•
•import java.util.regex.Matcher;
•import java.util.regex.Pattern;
Throw:
1)Throw keyword is used for throwing an exception.
Throws:
1)Used for declaring exceptions.
2)Doesn’t throw an exception.
3)Specifies that there may occur an exception in the method.
4)Always used with method signature.
Java Exception Handling Example:
}
Output:
Exception in thread "main" java.lang.ArithmeticException:
/ by zero .
Example:
public class TryCatchExample2 {
}
INTERNAL WORKING OF TRY-CATCH BLOCK:
JVM checks if the exception is handled or not. If the exception is not handled, it provides
a default exception handler to perform the following tasks.
Prints the exception description.
Prints the stack trace(hierarchy of methods where the exception occurred).
Causes the program to terminate.
JAVA CAN CATCH MULTIPLE EXCEPTIONS:
A try block can contain multiple catch blocks. Each catch block must contain a different
exception handler.
To perform different tasks when different exception occurs , we have to go for multi-catch
blocks.
At a time , only one exception occurs and only one catch block will be executed.
Catch blocks must be ordered from most specific to most general.
Example 1:
public class MultipleCatchBlock1 {
try{
int a[]=new int[5];
a[5]=30/0;
}
catch(ArithmeticException e)
{
System.out.println("Arithmetic Exception occurs");
}
catch(ArrayIndexOutOfBoundsException e)
{
System.out.println("ArrayIndexOutOfBounds Exception occurs");
}
catch(Exception e)
{
System.out.println("Parent Exception occurs");
}
System.out.println("rest of the code");
}
}
Output:
HTML
Basic elements, Paragraphs,
REACT JS Colors, Forms, Input Types
LEARNING SERVLETS
Introduction, Exceptions,
PLAN Database Access
MYSQL JDBC
Mysql Introduction, JDBC
Components, Examples
Create A web app
REACT WEB APP
Project Building
OUR AGENDA
1.Core Java Concepts
2.Classes and Objects , Inheritance , Method Overloading , Method
Overriding
3.Abstract Class , Interface , Encapsulation , Wrapper Class
4.Javascript – Overview , Syntax, Placement, Variables
5.Javascript – Operators , If…Else, Switch Case , While Loop
6.JavaScript – For loop , For…in, Loop Control, Functions
7.Javascript - Events , Cookies , Page Redirect
8.Javascript - Dialog Boxes , Void Keyword , Page Printing
9.Javascript – Objects , Number , Boolean Strings
10.Javascript – Arrays , Date , Math , Regular Expressions , HTML DOM.
11.HTML Basic, Elements , Attributes , Headings
12.HTML Paragraphs , Styles , Formatting , Comments
13.HTML – Colors , CSS , links , images , tables
Day wise Learning 14.HTML – Forms , Form Attributes , Form Elements
Plan 1 -15 15.HTML – Input Types , Input Attributes , Input Form Attributes.
OUR AGENDA
16.VSCode Introduction , React Introduction, React Installation
17.Create React-App , React Features , Pros and Cons
18.ReactJS Vs AngularJS , ReactJS Vs ReactNative , React JSX
19.React Components , React State , React Props
20.React Props Validation , React State Vs Props , React Constructor
21.React Component API , Component Life Cycle , React Forms
22.Controlled Vs Uncontrolled , React Events , Conditional Rendering
23.React Lists , React Keys , React Refs
24.React Fragments , Router , CSS, React Table , Hooks
25.E Store Book Management System
26.Chat Application
27.Tour
28.Calculator App
Day wise Learning 29.Plant e Commerce
30.Quiz App
Plan 16 -30
TO LEARN
REACT JS
ALL PROJECTS IN NETBEANS
NEED SOME
BASICS OF JAVA
BEFORE THAT
'https://imjo.in/BJGJ4g
WHAT IS INTERNSHIP ?
OBJECTIVE OF THIS 30 DAYS
MASTER CLASS
https://imjo.in/BJGJ4g