Chapter 1 Unit 2 1739439891-4
Chapter 1 Unit 2 1739439891-4
UNIT-II
INTRODUCTION TO JAVA
INTRODUCTION
Java is an object oriented programming language developed primarily by
James Gosling and his colleagues at sun micro systems. The language was
initially called oak (named after the oak trees outside gosling's office)
• IMPORT JAVA.UTIL.*;
• CLASS WLOOP
• {
• {
• INT I,N;
• SYSTEM.OUT.PRINTLN("ENTER A NUMBER");
• N=SC.NEXTINT();
• I=1;
• WHILE(I<N)
• {
• IF(N%I==0)
• I++;
• }
• }
• }
JAVA RESERVED WORDS
• Java reserved words or the keywords are the words which carry special meaning to the system
compiler.
• These words are basically used for writing a Java statement.
• Such words cannot be used for naming a variable in the program.
DIFFERENT TYPES OF JAVA PROGRAMMING
Basically, there are two different platforms for writing Java programs. They are:
• Java Application
• Java Apple
The message needs to be written within double quotes (" ") enclosed within braces. If you want to display a
message along with a variable then it could be written as:
NOTE:
When a message is to be displayed along with a variable, they must be separated with '+' (plus) sign.
FEATURES OF BlueJ
Some of the features of BlueJ are given below:*
• The compilation as well as the execution of the program is comparatively easier than JDK 1.5 or 1.6
platform.
• It is a window-based platform where the user can perform the tasks more conveniently (by selecting and
• When you declare a class, it produces a sample program for the user to give a brief idea of programming.
• Debugging can also be done easily as it indicates the errors at the bottom pane of the same window.
• It also supports the syntax of the program which is written on JDK 1.5 or 1.6 (DOS based) platform.
• How to Start BlueJ.
• Execution of Java program.
• Modification in Java program.