0% found this document useful (0 votes)
1 views2 pages

Java Programming Notes1

Java is a programming language developed by Sun Microsystems in 1991, initially named 'Oak' before being renamed in 1995. It offers several advantages such as simplicity, security, portability, and robustness. The document also provides a simple Java program example, instructions for compiling and running it, as well as information on data types and variable declaration in Java.

Uploaded by

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

Java Programming Notes1

Java is a programming language developed by Sun Microsystems in 1991, initially named 'Oak' before being renamed in 1995. It offers several advantages such as simplicity, security, portability, and robustness. The document also provides a simple Java program example, instructions for compiling and running it, as well as information on data types and variable declaration in Java.

Uploaded by

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

Java Programming

Introduction

Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike Sheridan at
Sun Microsystems, Inc. in 1991. It took 18 months to develop the first working version. This language
was initially called “Oak,” but was renamed “Java” in 1995.

Advantages of Java

• Simple
• Secure
• Portable
• Object-oriented
• Robust
• Multithreaded
• Architecture-neutral
• Interpreted
• High performance
• Distributed
• Dynamic

A First Simple Program

/*
This is a simple Java program.
Call this file "[Link]".
*/
class Example
{
public static void main(String args[])
{
[Link]("This is a simple Java program.");
}
}

Compiling the Program


To compile the Example program, execute the compiler, javac, specifying the name of the
source file on the command line, as shown here:
C:\>javac [Link]
The javac compiler creates a file called [Link] that contains the bytecode version
of the program. As discussed earlier, the Java bytecode is the intermediate representation
of your program

Running the program


To run the program, you must use the Java application launcher, called java.
C:\>java Example
When the program is run, the following output is displayed:
This is a simple Java program.

Data types

long –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807


int –2,147,483,648 to 2,147,483,647
short –32,768 to 32,767
byte –128 to 127
double 4.9e–324 to 1.8e+308
float 1.4e–045 to 3.4e+038
char a to z
Boolean true or false

Variables
The variable is the basic unit of storage in a Java program.

Declaring a Variable
In Java, all variables must be declared before they can be used. The basic form of a variable
declaration is shown here:

type identifier [ = value][, identifier [= value] ...] ;

You might also like