0% found this document useful (0 votes)
7 views43 pages

Introduction to Java Programming Basics

The document provides an introduction to Java, covering its history, features, and basic programming concepts such as variables, data types, and conditional statements. It explains the use of Integrated Development Environments (IDEs), user input handling, arithmetic operators, and the structure of loops in Java. Additionally, it emphasizes the importance of problem-solving in programming.

Uploaded by

Claire Fernandez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views43 pages

Introduction to Java Programming Basics

The document provides an introduction to Java, covering its history, features, and basic programming concepts such as variables, data types, and conditional statements. It explains the use of Integrated Development Environments (IDEs), user input handling, arithmetic operators, and the structure of loops in Java. Additionally, it emphasizes the importance of problem-solving in programming.

Uploaded by

Claire Fernandez
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Let’sCode

in!

PREPARED BY:
SHERILYN PADILLA TOBIAS, MIT
INTRODUCTION TO JAVA

• Most popular language created in 1991, publicly


released by 1995
• Developed by James Gosling at Sun
Microsystems
• Java was later acquired by Oracle
• Simple and Easy to use
• Write once and Run anywhere
HOW A JAVA PROGRAM IS RUN?
HOW A JAVA PROGRAM IS RUN?
HOW A JAVA PROGRAM IS RUN?
WHAT IS AN IDE?

I – Integrated
D – Development
E - Environment
Software used by developer so they can easily
code in a programming language, IDE has tons
of features that makes programming easier.
VARIABLES
&
DATATYPES
VARIABLES

 Variables are used to store up


temporary data to be used in our
program’s runtime
 A placeholder for a value that
behaves as the value it contains
DATA TYPE

The type of data inside our variable


STANDARD DATA TYPES IN PROGRAMMING
• Characters – char (Holds a single character)
• String – String (Holds a set of characters/text)
• Boolean – boolean (Holds True or False)
• Integers
byte – (-128 to 127)
short – (-32768 to 32767)
int – (-2147,483,648 to 2,147,483,647)
long – (9,223,372,036,854,775,808 to
9,223,372,036,854,755,807)
• Floating Point
float
IDENTIFIER
• It is the name of the variables that the
programmer indicated, it is used to Read and
Write to the variable.
Rules of Identifier
- Do not use any special characters other than underscore
- Do not use whitespaces
- Do not use numbers alone
- You can use numbers but along with letters
DECLARING VARIABLES

Syntax:
datatype identifier;
datatype identifier = value;
LET’S START CODING
[Link]();
- Used to display something in the
console

[Link]();
- Used to display something in the
console on the same line
USER INPUT
&
ARITHMETIC OPERATORS
WHAT IS BUILT-IN PACKAGES?

• JAVA API has many pre written classes to


help the programmer manage input,
database and etc.
IMPORTING PACKAGES

• IMPORT SPECIFIC CLASS


import [Link]
• IMPORT WHOLE PACKAGE
import packagename.*
[Link]
•A class in the [Link] package that
helps programmers handle inputs
from the user
Functions: Below are mentioned the method to scan the
primitive types from console input through Scanner
class.
 nextLine()
 nextInt()
 nextFloat()
 nextDouble()
 nextLong()
 nextShort()
 nextBoolean()
 nextByte()
USER INPUT

String x;
Scanner s = new Scanner([Link]);
x = [Link]();
SO
ARITHMETIC OPERATORS
SYMBOLS OPERATION RESULT USAGE

+ Addition Sum x+y

- Subtraction Difference x-y

* Multiplication Product x*y

/ Division Quotient x/y

% Modulus Remainder x%y

++ Increment Add 1 x++

-- Decrement Subtract 1 x--


CONDITIONAL STATEMENT
WHAT IS CONDITIONAL
STATEMENT?
•Allows a program to take action based on
the given condition. It makes our
program smarter
•Typically, it compares two values so that
our program can decide what action
should be taken
RELATIONAL OPERATORS
LABEL SYMBOL SYNTAX

Equals == X==y

NOT Equals != X!=y

Less than < X<y

Less than or equals <= X<=y

Greater than > X>y

Greater than or equals >= X>=y


TYPES OF CONDITIONAL STATEMENT

• IF Statement – Handles one conditional


expression, It either does SOMETHING or
NOTHING
SYNTAX if(condition){
//Do Everything you want
here
}
TYPES OF CONDITIONAL STATEMENT
• IF – ELSE Statement – Handles two
conditional expressions, It either does the
first code block or the second
if (condition){ code block
SYNTAX //Do Everything you
want here
}else{
//Do everything you
want here
}
TYPES OF CONDITIONAL STATEMENT
• IF – ELSE IF - ELSE Statement – Handles 3 or
more conditional expressions, It will run a certain
if (condition){
blocked based on the//Do Everything you want
condition
here
SYNTAX
}else if (condition){
//Do everything you want
here
}else{
//Do Everything you want
here
TYPES OF CONDITIONAL STATEMENT
• NESTED Conditional Statement– A conditional
statement within a conditional statement

if (condition){
SYNTAX if (condition){
//Do anything you want
here
}
}
JAVA
LOOPS
WHAT IS LOOP?

• Loops in programming allow a set of


instructions to be executed repeatedly until a
certain condition is fulfilled. Loops are also
known as iterating statements or looping
statements
• In Java, there are three kinds of loops which
are – the for loop, the while loop, and
the do-while loop.
WHILE LOOP

• It is used when you want a code block to


run repeatedly while a condition is met
SYNTAX:
while(condition){
//Do anything here
}
DO-WHILE LOOP
• Same as the While Loop but it executes
the code block first before checking the
condition
SYNTAX:
do{
//Do anything here
} while(condition);
FOR LOOP
• It is used when you want a code block to run
repeatedly while a condition is met
• It’s a more compact format but more
complicated version of a while loop.
SYNTAX:
for(initialization; condition; operation){
//do anything here
}
“PROGRAMMING IS
NOT ABOUT WHAT
YOU KNOW; IT’S
ABOUT WHAT YOU
CAN FIGURE OUT.”

You might also like