# Programming

&#x20;What Is Programming?&#x20;

Programming is the process of creating a set of instructions that tell a computer how to perform a task.&#x20;

Java Is a programming language and a platform

&#x20;**Platform**- Any hardware or software environment in which a program runs, is known as platform. Since Java has its own runtime environment (JRE) and API it is called platform. Java language developed at SUN Micro Systems in the year 1995 under the guidance of James Gosling and their team.

&#x20;Java Version History&#x20;

Now a day 8 versions of java are released, which is listed below with realizing date.&#x20;

* &#x20;JDK Alpha and Beta (1995)          &#x20;
* JDK 1.0 (23rd Jan, 1996)&#x20;
* &#x20;JDK 1.1 (19th Feb, 1997)&#x20;
* &#x20;J2SE 1.2 (8th Dec, 1998)&#x20;
* &#x20;J2SE 1.3 (8th May, 2000)&#x20;
* J2SE 1.4 (6th Feb, 2002)
* &#x20;J2SE 5.0 (30th Sep, 2004)
* &#x20;Java SE 6 (11th Dec, 2006)
* &#x20;Java SE 7 (28th July, 2011)
* &#x20;Java SE 8 (18th March, 2014)

&#x20;Java divided into three categories, they are

&#x20;1\. J2SE (Java 2 Standard Edition)

&#x20;2\. J2EE (Java 2 Enterprise Edition)

&#x20;3\. J2ME (Java 2 Micro or Mobile Edition)&#x20;

J2SE

&#x20;J2SE is used for developing client side applications.&#x20;

J2EE&#x20;

J2EE is used for developing server side applications.

* &#x20;J2ME

&#x20;J2ME is used for developing mobile or wireless application by making use of a predefined protocol called WAP (wireless Access / Application protocol).&#x20;

There are 3 stages of Java Application development,&#x20;

1\) Coding/Composition

&#x20;2\) Compilation&#x20;

3\) Execution&#x20;

1\) Coding: Developing a program according to java syntax (rules) is called as Coding.&#x20;

Note: All the java programs should be saved with file-name.java extension.

&#x20;2\) Compilation: Converting the java program written in high level language into byte code by using java compiler is called as Compilation.

&#x20;Note: All the byte code will be stored as .class Extension&#x20;

3\) Execution: Converting the byte code into machine level language or processor understandable instructions using JVM is called as Execution (JVM is an Interpreter).

&#x20;                                                       **Tokens**

&#x20;Tokens are smallest unit of a program that is meaningful to the compiler. There are 3 important tokens,&#x20;

1\) Keywords.

&#x20;2\) Literals.

&#x20;3\) Identifiers.&#x20;

1\) Keywords: This are pre-defined words in the programming language which will have some pre-defined meaning. Example: class, public, static, void, etc.&#x20;

The Java programming language has total of 53 reserved keywords which have special meaning for the compiler and cannot be used as variable names.

&#x20;Rules to write keywords: All keywords must be written in lower case.

&#x20;2\) Identifiers: Programmer defined words are called as Identifier. Example: Name of variable, Name of a class, Name of a package, Name of an interface. Rules to write Identifier:&#x20;

A) Identifier can be alphanumeric, no special characters are allowed except $, &, -. B)Identifier cannot start with a number but can start with an alphabet.

&#x20;C) Space is not allowed.&#x20;

D) Keywords cannot be Identifier.

&#x20;3\) Literals: Any constant value which can be assigned to the variable is called as literal/constant. There are 4 literals,&#x20;

A) Numeric Literals: Any number represented in java program will fall under numeric literals category.&#x20;

B) Character Literals: Any character of the keyboards enclosed within single quote and 1 character within single quote is called as character literals. Example: ‘A’, ‘I’,’9’.

&#x20;C) String Literals: Anything which is enclosed within double quotes is considered as String literals. Example: “hello”, “hello123”.&#x20;

D) Boolean Literals: There are only 2 Boolean literals True and False. To take decision we will use Boolean literals. Note:&#x20;

1\) True and False are also called as reserved words.&#x20;

2\) 0 and 1 are not Boolean literals.

&#x20;3\) Using System.out.println();, we can print Literals

&#x20;Rule: 1) While writing java program, programmer should follow the condition of java programming language if the programmer is not following rules and conditions of java programs then java compiler will deploy Compile Time Error (CTE).

&#x20;2\) If the program results in compile time error, .class file won’t be generated.
