0% found this document useful (0 votes)
74 views

Java - : Google's Android Os Media Players Antivirus Web App Desktop App Etc

Java was created in the early 1990s by James Gosling at Sun Microsystems, and is now owned by Oracle, it is a popular object-oriented programming language that is platform independent and can be used to create a wide range of applications from mobile apps to desktop programs. Java uses classes and most programs begin with a main method, it has built-in data types like int and string and operators for math functions and assignment while comments are used to annotate code and documentation.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Java - : Google's Android Os Media Players Antivirus Web App Desktop App Etc

Java was created in the early 1990s by James Gosling at Sun Microsystems, and is now owned by Oracle, it is a popular object-oriented programming language that is platform independent and can be used to create a wide range of applications from mobile apps to desktop programs. Java uses classes and most programs begin with a main method, it has built-in data types like int and string and operators for math functions and assignment while comments are used to annotate code and documentation.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

java --- Platform Independent

System.out.println("Hello world!") ; Portable, robust, and dynamic, with the


java script ability to fit the needs of virtually any type
document.write( 'Hello, world!') ; of application.

by James Gosling How many java platform need to create


(at sun microsystem, (acquired by Oracle)
- 1 version

released (renamed as java) year 1995 More than 3 billion devices run java
 jdk - java development kit  google's android
 ide - integrated development environment
 os
 JVM (Java Virtual Machine)
 JRE (Java Runtime Environment)  media players
 antivirus
java/oak
 web app
James Gosling, Mike Sheridan, Patrick Naughton
 desktop app
(june 1991)
 etc
Java has a huge community
Object-oriented programming - Java is an
object-oriented language. This helps to make Every program in Java must have a class.
our Java code more flexible and reusable.
Every Java program starts from the main
method.
Starting piont for all Java Progam is - MAIN
public - anyone can acces
static - method can be run without creating
an instance of the class containing the
main method
void - method doesn't return any value
main - the name of the method
println method prints a line of text to the
screen.
System class and its out stream are used to
access the println method.
Java is a high level, modern programming
language designed in the early 1990s by
Sun Microsystems, and currently owned by
Oracle.
java syntax java variable
// This is a single-line comment Create a variable named carName and assign
the value Volvo to it.
/* This is a multi-line comment */
String carName = "Volvo";
Note that Java does not support nested multi-
line comments. create a variable named maxSpeed and assign
the value 120
However, you can nest single-line comments
int maxSpeed = 120;
within multi-line comments.
Display the sum of 5 + 10, using two variables: x
and y.
Another name for a Multi-Line comment is a
int x = 5;
Block comment.
int y = 10;
System.out.println(x + y);

/** a documentation comment */ Create a variable called z, assign x + y to it, and


display the result.
Javadoc is a tool which comes with JDK and it is
used for generating Java code documentation in int x = 5;
HTML format from Java source code which has int y = 10;
required documentation in a predefined format. int z = x + y;
System.out.println(z);

create three variables of the same type, using a


comma-separated list:

int x = 5, y = 6, z = 50;
System.out.println(x + y + z);
java data types java operators
int myNum = 9; multiply - * devide - /
float myFloatNum = 8.99f;
char myLetter = 'A';
boolean myBool = false; operator to increase the value of the
String myText = "Hello World"; variable x by 1

 num = int int x = 10;


 floatnum = float ++x;
 letter = char
addition assignment
 bool = Boolean
 text = string int x = 10;
byte, short, int, long, float, double, boolean and x += 5;
char – PRIMITIVE Java string " "
Variables have types. Some examples: corect method of txt
- int: for integers (whole numbers) such as 123 String txt = "Hello";
and -456 System.out.println(txt.length());

- double: for floating-point or real numbers upper case


with optional decimal points and fractional String txt = "Hello";
parts in fixed or scientific notations, such as System.out.println(txt.toUpperCase());
3.1416, -55.66. Concatenate two string = +
- String: for texts such as "Hello" or "Good (concat)
Morning!". Text strings are enclosed within Java arithmetic operators:
double quotes.
+ addition
- char stands for character and holds a single
character. - subtraction

- Boolean type, which has only two possible * multiplication


values: true and false. (This data type is used
/ division
for simple flags that track true/false
conditions.) % modulo (quotient ans)

 Read a byte - nextByte()


 Read a short - nextShort()
Arithmetic operators are used in mathematical
 Read an int - nextInt()
expressions in the same way that they are used
 Read a long - nextLong()
in algebraic equations.
 Read a float - nextFloat()
 Read a double - nextDouble()
 Read a boolean - nextBoolean()
 Read a complete line - nextLine()
 Read a word - next()
 declaring integer variable - int var
 assignment operator (=)
 Addition and assignment (+=)
 multiplication and assignment (*=),
 division and assignment (/=),
 remainder and assignment (%=)
 Subtraction and assignment (-=)

You might also like