The document discusses the basics of programming in Java, including the structure of a Java program, the use of flowcharts, and the importance of reserved words and comments. It also covers the differences between compilers and interpreters, as well as various types of operators and data types in Java. Additionally, it highlights the syntax for input and output statements in Java programming.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
17 views31 pages
(Java Basics) For New Learners
The document discusses the basics of programming in Java, including the structure of a Java program, the use of flowcharts, and the importance of reserved words and comments. It also covers the differences between compilers and interpreters, as well as various types of operators and data types in Java. Additionally, it highlights the syntax for input and output statements in Java programming.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 31
ber and store it in variable A
fe another number and store it in variable B
dA and B and store the result in variable C
play the value of C
nical representation of an
algorithm is called the flowchart.
lowchart
t step after writing an algorithm Is to produce a flowchart. The flowchart
is a pictoy
tation of the algorithm.
e four basic symbols in a flow
erform. They are:
[Ov you KNow (7) 4+
‘The first flowchart was drawn by Fi i
in the year 1921. es sper
chart, which represent the kind of task that the comp
The Start or End box
The Processing box
The Decision-making box
Input-output boxint x, Ys 25
‘System.out.printin(“Enter
three integers “)i
Scanner in = new
Scanner(System.in);
x= in.nextint0;
y in.nextint();
z= in.nextInt0);
if (x>y 8&X>Z)
system.out.printin(“First
number |S largest.”);
else if (y>x &&Y> 2)
ystem.out.printin("“Seco
number is largest.”);
else if (z>x&&2>Y)
system.out.printin Third
number iS largest.”);
else
ystem.out.printin(“Ente e
numbers are not distinct.”);ny other
omponents of a Program
ns written in a programming langué
nallest unit of a pr is refe
smponents of a progein_ OSadh, vedwm
impact javaaaht|
public Cass Poeftlays all the errors together”!
» __ Interpreter ——e
High Level Language
(System Program) (Object Progany
Differences between a Compiler and an Interpreter
he whole source program 1. It converts the source Program into
ject program at once. the object program one line at a tine.
isplays the errors for the 2. It displays the errors, one line
program together, after the time and only after debugging tht
n. error the control goes to! je mex
TYPES OF HIGH LEVEL LANGUAGES
ligh level languages are broadly classified into three major categor ‘eg
High Level Languages _
’
Structure Ofieriten 1 cnnTo support mathemati
decimal both)
JAVA RESERVED WORDS
va reserved -words-or-the keywords are the words which. carry special meaning —
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.
Some of the reserved words or keywords are listed as below:
Se witch else break i
cm noms
int ~~ ‘double ‘t ser
ie —
do
try
for
catch
shorta program in Java is entirely different
s essential to know the following points
*Comments in a program: The comment statement is a non
statement in Java. It is included for the sake of the users to inders
action is going to be taken in a program or statement,
* Declaration of class: It contains the word, access Specifier (Le., public)
defines the keyword ‘class’ which is followed by a meaningful q
For example, if you are writing a program to find the sum of two m,
then it could be written as public class Sum. Conventionally, the dos
starts with an uppercase letters.
* Declaration of main function:
The main( ) function encloses the
programming statements within the
opening and closing curly braces { }.
The main() function is further enclosed
within { } under class heading.
* The termination of each statement
“must be indicated with a semi-colon.
~—~* The closing of curly braces indicates
the closing of a block of statements, function and class.
ample, Syste
The message needs
ou want t
System:
P is the variat
result of the exec)
Output: The sum of tOu
wm ‘TPUT STATEMENT IN JAVA PROGRAMMING
he statement which is used to get the output of the program or to display
Messages on the screen, is given as:
System.out.println();
Syntax: