SlideShare a Scribd company logo
5
Most read
6
Most read
7
Most read
Learn To Code: Intro to Java
Jahnavi Bollineni
Core Team Member
T R Sai Rakshith
Technical Team Member
P Sadhana
GDSC Lead
Introduction to Java
●Statically typed language
●Platform Independent
●Object-oriented programming language.
●Dynamic flexibility
●Mobile applications (specially Android
apps)
●Desktop applications
●Web applications
●Web servers and application servers
●Games
●Database connection
Applications of Java
Architecture
● Java source code program(.java extension).
● JAVA Compiler to compile the source code
● Java bytecode program(.class extension)
● pass the java bytecode through an
interpreter called JVM (JAVA Virtual Machine)
● JVM converts and execute the code.
Working
●Every line of code that runs in Java
must be inside a class
●public - Access Modifier
●static - keyword
●void - keyword
method doesn’t return anything
● main - function
● String[ ] args - Java command line
arguments
Output in Java
public class Main
{
public static void main ( String[ ] args )
{
System.out.println("Hello
World");
}
}
Input in Java ● import java.util.Scanner;
● Scanner in = new
Scanner(System.in);
import java.util.Scanner;
public class Main
{
public static void main (String[ ] args)
{
Scanner input = new
Scanner(System.in);
String name = input.next();
System.out.println("Hello " + name);
}
}
Datatypes
Data types specify the different sizes and values that can be stored in the variable. There
are two types of data types in Java:
1.Primitive data types: The primitive data types include boolean, char, byte, short, int,
long, float and double.
2.Non-primitive data types: The non-primitive data types include Classes, Interfaces, and
Arrays.
What are Datatypes?
Learn To Code: Introduction to java
Operators in Java
There are many types of operators in Java which are given below:
● Unary Operator: expr++, expr--, ++expr, --expr, +expr, -expr
● Arithmetic Operator: *, /, %, +, -
● Relational Operator: <, >, <=, >=, ==, !=
● Bitwise Operator: &, |, ^
● Logical Operator: &&, ||
● Ternary Operator: ? :
● Assignment Operator: =, +=, -=, *=, /=, %=
Operator in Java is a symbol that is used to perform operations
● A variable is a name of the memory location.
● It is used to store data.
● Its value can be changed
● It is a way to represent memory location through symbol so that it can
be easily identified.
Let's see the syntax to declare a variable:
type variablename;
Variables
A little into variables!
Types of Variables in Java
●Local variable - A variable declared inside the body of the method is called local variable.
●Instance variable - A variable declared inside the class but outside the body of the
method, is called an instance variable.
●Static variable - A variable that is declared as static is called a static variable.
if, if-else and if-else-if ladder
Selection
Simple if statement:
if(condition)
{
statement 1;
}
if-else statement:
if(condition)
{
statement 1;
}
else
{
statement 2;
}
if-else-if ladder:
if(condition 1) {
statement 1;
}
else if(condition 2) {
statement 2;
}
else {
statement 2;
}
Syntax:
for loop
Iterations
Syntax:
for(initialization; condition; increment/decrement)
{
//block of statements
}
while loop
Iterations
Syntax:
while(condition){
//looping
statements
}
do - while loop
Iterations
do
{
//statements
} while (condition);
Syntax:
Switch Case
The Java switch statement executes one statement from multiple conditions.
1.It is like if-else-if ladder statement.
2.Switch cases works with byte, short, int, long, enum types and wrapper styles.
3.A switch statement can have an optional default case, which must appear at the end of
the switch. The default case can be used for performing a task when none of the cases is
true. No break is needed in the default case.
What are Switch cases?
Switch Case
1.The switch expression is evaluated once.
2.The value of the expression is compared with the values of each case.
3.If there is a match, the associated block of code is executed.
4.The break and default keywords are optional.
How do they work?
Switch Case
switch(expression) {
case x:
// code block
break;
case y:
// code block
break;
default:
// code block
}
Syntax:
Methods in Java
● To call a method in Java, write the method's name followed by two parentheses () and a
semicolon.
● A method is a collection of statements that perform some specific task and return the
result to the caller.
● Methods allow us to reuse the code without retyping the code.
Components of a method
● Modifier
● The return type
● Method name
● Parameter list
● Exception list
● Method Body
Any doubts?

More Related Content

PPTX
Learn To Code: Diving deep into java
PPTX
Introduction to JavaScript
PPTX
Learn To Code: Introduction to c
PPTX
Advanced Javascript
PPT
JavaScript Data Types
DOC
Typescript Basics
PDF
Java essentials for hadoop
PPTX
Java script
Learn To Code: Diving deep into java
Introduction to JavaScript
Learn To Code: Introduction to c
Advanced Javascript
JavaScript Data Types
Typescript Basics
Java essentials for hadoop
Java script

What's hot (20)

PPTX
Introduction to JavaScript Programming
PDF
8 introduction to_java_script
PDF
Effective PHP. Part 5
PDF
Effective PHP. Part 6
PPTX
Introduction to JavaScript
PDF
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
PDF
Javascript - Tutorial
PPTX
C++ programming introduction
PPT
Javascript
PDF
Effective PHP. Part 4
PPT
Java findamentals2
PPT
JavaScript Variables
PPTX
Typescript
PDF
JavaScript Programming
PPTX
Developer’s viewpoint on swift programming language
PDF
C,s&s
PPT
The JavaScript Programming Language
PPTX
Javascript functions
PPTX
Placement and variable 03 (js)
PPTX
Chapter 2 java
Introduction to JavaScript Programming
8 introduction to_java_script
Effective PHP. Part 5
Effective PHP. Part 6
Introduction to JavaScript
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Javascript - Tutorial
C++ programming introduction
Javascript
Effective PHP. Part 4
Java findamentals2
JavaScript Variables
Typescript
JavaScript Programming
Developer’s viewpoint on swift programming language
C,s&s
The JavaScript Programming Language
Javascript functions
Placement and variable 03 (js)
Chapter 2 java
Ad

Similar to Learn To Code: Introduction to java (20)

PPTX
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
PPTX
imperative programming language, java, android
 
PPTX
Object-Oriented Programming with Java UNIT 1
PPTX
Unit-1_GHD.pptxguguigihihihihihihoihihhi
PPTX
Advanced javascript from zero to hero in this PPT
PDF
Java basic concept
PPTX
JAVA(module1).pptx
PPTX
Let's start with Java- Basic Concepts
PDF
java notes.pdf
PPTX
Java For Automation
PPT
Java Basics for selenium
PPTX
Java Tokens in java program . pptx
PPTX
Java introduction
PPTX
Java subject for the degree BCA students
PPTX
UNIT 2 programming in java_operators.pptx
PDF
M251_Meeting 1(M251_Meeting 1_updated.pdf)
PPT
SMI - Introduction to Java
PPTX
Programming in java basics
PPTX
Core java
Assignmentjsnsnshshusjdnsnshhzudjdndndjd
imperative programming language, java, android
 
Object-Oriented Programming with Java UNIT 1
Unit-1_GHD.pptxguguigihihihihihihoihihhi
Advanced javascript from zero to hero in this PPT
Java basic concept
JAVA(module1).pptx
Let's start with Java- Basic Concepts
java notes.pdf
Java For Automation
Java Basics for selenium
Java Tokens in java program . pptx
Java introduction
Java subject for the degree BCA students
UNIT 2 programming in java_operators.pptx
M251_Meeting 1(M251_Meeting 1_updated.pdf)
SMI - Introduction to Java
Programming in java basics
Core java
Ad

More from SadhanaParameswaran (18)

PPTX
Introduction to Web Development - JavaScript
PPTX
Introduction to Web Development - CSS
PPTX
Introduction to Web Development - HTML
PPTX
Introduction to data science.pptx
PPTX
Flutter Festivals GDSC ASEB | Introduction to Flutter
PPTX
Flutter Festivals GDSC ASEB | Introduction to Dart
PPTX
Explore ML with Crowdsource | Neural Networks - Session 3
PPTX
Explore ML with Crowdsource | ML Extended - Session 4
PPTX
Android Study Jams Session 5
PPTX
Explore ML with Crowdsource | Intro to ML - Session 2
PPTX
Android Study Jams Session 4
PPTX
Android Study Jams - Session 3
PPTX
Android Study Jams - Session 2
PPTX
Android Study Jams - Session 1
PPTX
Learn To Code: Next steps for python
PPTX
Hacktoberfest 2021
PPTX
Dominion over domains
PPTX
30 days of google cloud 2021
Introduction to Web Development - JavaScript
Introduction to Web Development - CSS
Introduction to Web Development - HTML
Introduction to data science.pptx
Flutter Festivals GDSC ASEB | Introduction to Flutter
Flutter Festivals GDSC ASEB | Introduction to Dart
Explore ML with Crowdsource | Neural Networks - Session 3
Explore ML with Crowdsource | ML Extended - Session 4
Android Study Jams Session 5
Explore ML with Crowdsource | Intro to ML - Session 2
Android Study Jams Session 4
Android Study Jams - Session 3
Android Study Jams - Session 2
Android Study Jams - Session 1
Learn To Code: Next steps for python
Hacktoberfest 2021
Dominion over domains
30 days of google cloud 2021

Recently uploaded (20)

PDF
Computing-Curriculum for Schools in Ghana
PPTX
Cell Structure & Organelles in detailed.
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Basic Mud Logging Guide for educational purpose
PPTX
master seminar digital applications in india
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
Cell Types and Its function , kingdom of life
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Complications of Minimal Access Surgery at WLH
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
GDM (1) (1).pptx small presentation for students
PDF
Classroom Observation Tools for Teachers
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Lesson notes of climatology university.
Computing-Curriculum for Schools in Ghana
Cell Structure & Organelles in detailed.
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Basic Mud Logging Guide for educational purpose
master seminar digital applications in india
STATICS OF THE RIGID BODIES Hibbelers.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Cell Types and Its function , kingdom of life
Microbial diseases, their pathogenesis and prophylaxis
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Complications of Minimal Access Surgery at WLH
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
GDM (1) (1).pptx small presentation for students
Classroom Observation Tools for Teachers
Supply Chain Operations Speaking Notes -ICLT Program
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Lesson notes of climatology university.

Learn To Code: Introduction to java

  • 1. Learn To Code: Intro to Java Jahnavi Bollineni Core Team Member T R Sai Rakshith Technical Team Member P Sadhana GDSC Lead
  • 2. Introduction to Java ●Statically typed language ●Platform Independent ●Object-oriented programming language. ●Dynamic flexibility
  • 3. ●Mobile applications (specially Android apps) ●Desktop applications ●Web applications ●Web servers and application servers ●Games ●Database connection Applications of Java
  • 5. ● Java source code program(.java extension). ● JAVA Compiler to compile the source code ● Java bytecode program(.class extension) ● pass the java bytecode through an interpreter called JVM (JAVA Virtual Machine) ● JVM converts and execute the code. Working
  • 6. ●Every line of code that runs in Java must be inside a class ●public - Access Modifier ●static - keyword ●void - keyword method doesn’t return anything ● main - function ● String[ ] args - Java command line arguments Output in Java public class Main { public static void main ( String[ ] args ) { System.out.println("Hello World"); } }
  • 7. Input in Java ● import java.util.Scanner; ● Scanner in = new Scanner(System.in); import java.util.Scanner; public class Main { public static void main (String[ ] args) { Scanner input = new Scanner(System.in); String name = input.next(); System.out.println("Hello " + name); } }
  • 8. Datatypes Data types specify the different sizes and values that can be stored in the variable. There are two types of data types in Java: 1.Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and double. 2.Non-primitive data types: The non-primitive data types include Classes, Interfaces, and Arrays. What are Datatypes?
  • 10. Operators in Java There are many types of operators in Java which are given below: ● Unary Operator: expr++, expr--, ++expr, --expr, +expr, -expr ● Arithmetic Operator: *, /, %, +, - ● Relational Operator: <, >, <=, >=, ==, != ● Bitwise Operator: &, |, ^ ● Logical Operator: &&, || ● Ternary Operator: ? : ● Assignment Operator: =, +=, -=, *=, /=, %= Operator in Java is a symbol that is used to perform operations
  • 11. ● A variable is a name of the memory location. ● It is used to store data. ● Its value can be changed ● It is a way to represent memory location through symbol so that it can be easily identified. Let's see the syntax to declare a variable: type variablename; Variables A little into variables!
  • 12. Types of Variables in Java ●Local variable - A variable declared inside the body of the method is called local variable. ●Instance variable - A variable declared inside the class but outside the body of the method, is called an instance variable. ●Static variable - A variable that is declared as static is called a static variable.
  • 13. if, if-else and if-else-if ladder Selection Simple if statement: if(condition) { statement 1; } if-else statement: if(condition) { statement 1; } else { statement 2; } if-else-if ladder: if(condition 1) { statement 1; } else if(condition 2) { statement 2; } else { statement 2; } Syntax:
  • 14. for loop Iterations Syntax: for(initialization; condition; increment/decrement) { //block of statements }
  • 16. do - while loop Iterations do { //statements } while (condition); Syntax:
  • 17. Switch Case The Java switch statement executes one statement from multiple conditions. 1.It is like if-else-if ladder statement. 2.Switch cases works with byte, short, int, long, enum types and wrapper styles. 3.A switch statement can have an optional default case, which must appear at the end of the switch. The default case can be used for performing a task when none of the cases is true. No break is needed in the default case. What are Switch cases?
  • 18. Switch Case 1.The switch expression is evaluated once. 2.The value of the expression is compared with the values of each case. 3.If there is a match, the associated block of code is executed. 4.The break and default keywords are optional. How do they work?
  • 19. Switch Case switch(expression) { case x: // code block break; case y: // code block break; default: // code block } Syntax:
  • 20. Methods in Java ● To call a method in Java, write the method's name followed by two parentheses () and a semicolon. ● A method is a collection of statements that perform some specific task and return the result to the caller. ● Methods allow us to reuse the code without retyping the code.
  • 21. Components of a method ● Modifier ● The return type ● Method name ● Parameter list ● Exception list ● Method Body