1/35
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Java
is a popular programming language created in 1995.
it is owned by Oracle, and more than 3 bilion devices run using this language.
Java Syntax
the name of the java file must be match the class name. When saving the file, saveit using the class name and add “.java” at the end.
Main Method
is required and you will see it in every Java Programming. Any code inside this will be executed.
System.out.print()
inside the main() method, we can use this method to print a line if text to the screen
Double Quotes
when your working with a text, it must be wrapped around with “ “.
Print() Method
this also a print() method which is similar to println(). the only difference is that it does not insert a new line at the end of the output
Print Numbers
you can also use println() method to print numbers. However, unlike text, we don't put it inside “ “.
Java Variable
string, int, float, char, boolean
String
store texts
int
store integers
float()
stores floating point numbers
char()
store a single character
boolean()
stores a value with two states: true or false
Identifiers
all java Variable must be identified with unique names. These unique names are called ____.
Primitive and Non-Primitive Data Type
Data Types
byte, short, int, long, float, double, boolean, and char.
Variables under Primitive Data Type
String, Array, Classes
Variables under Non-Primitive Data Type
Yes / No
On / Off
True / False
Boolean Type
Non-Primitive Data Type
are called reference type because they refer to objects.
Addition, Subtraction, Multiplication, Division, Modulus, Increment, Decrement
Arithmetic Operators
+
Operation for Addition
*
Operation for Multiplication
/
Operation for Division
%
Operation for Modulus
++
Operation for Increment
- -
Operation for Decrement
Single-Line Comment
starts with the forward dash ( // )
Multiple - Line Comments
starts with ( /* ) and ends with ( /* )
Java Operators
are used to perform operation on variables and values
Arithmetic Operators
Are use to perform common mathematical equations
Assignment Operators
are use to assign values to a variables
Comparison Operation
are used to compare values ( or variables )
Logical Operators
are use to determine the logic between variables and value
Java String
a variable contains a collection of characters surrounded by double quotes.
String Length
in java, is actually an object which contains method that can perform certain operations onnstrings
More String Method
there are many string methods available for example : toUpper() and toLower()