0% found this document useful (0 votes)
39 views6 pages

6th Day Core Java Classes

The document contains examples of Java programs that demonstrate: 1) Adding two numbers and printing the sum 2) Displaying employee details like ID, name, designation and salary 3) It also includes assignments to create programs to display book and student details. The document further explains the difference between print() and println() methods and defines environment variables and the advantage of having JavaPath in environment variables.

Uploaded by

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

6th Day Core Java Classes

The document contains examples of Java programs that demonstrate: 1) Adding two numbers and printing the sum 2) Displaying employee details like ID, name, designation and salary 3) It also includes assignments to create programs to display book and student details. The document further explains the difference between print() and println() methods and defines environment variables and the advantage of having JavaPath in environment variables.

Uploaded by

New king India
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Dt : 21/2/2023

Ex-program-2:

wap to display the sum of two numbers?

class Addition

i
public static void main(String args[])

thi
{

int a=10,b=20;

ipa
int c=a+b;

System.out.println("a value="+a);

System.out.println("b value="+b);
Ma
System.out.print("c value="+c);
sh
}
ate

}
nk

o/p:

a value=10
Ve

b value=20

c value=30

===============================================================

faq:

wt is the diff b/w


(i)print()

(ii)println()

(i)print():

=>print() method will display message and result,and makes the cursor

i
wait in the same line.

thi
(ii)println():

=>println() method also display message and result,and moves the

ipa
cursor to next line or new line.
Ma
===================================================================
=

Note:
sh
=>"+" symbol in print() method will concatenate(combine) message with

result.
ate

==================================================================

Ex-3 :
nk

wap to display Employee-details?


Ve

(id,name,desg,sal)

class Employee

{
public static void main(String args[])

String id = "SE121";

String name = "Alex";

String desg = "SE";

i
int sal = 30000;

thi
System.out.println("EmpId="+id);

System.out.println("EmpName="+name);

ipa
System.out.println("EmpDesg="+desg);

}
Ma
System.out.println("EmpSalary="+sal);

}
sh
ate

o/p:
nk

EmpId=SE121

EmpName=Alex
Ve

EmpDesg=SE

EmpSalary=30000

===================================================================
=

Assignment-1:
wap to display BookDetails?

(code,name,author,price,qty)

Assignment-2:

wap to display StudentDetails?

i
(name,branch,rollNo,6 sub marks,totMarks,per)

thi
name=

ipa
branch=

rollNo=

s1=
Ma
s2=
sh
s3=
ate

s4=

s5=
nk

s6=

totMarks = s1+s2+s3+s4+s5+s6;
Ve

per =

===================================================================
==

faq:
define "Environment Variables"?

=>Environment variables are OperatingSystem variables,which hold the

information about S/W components installed in ComputerSystem.

=>These Environment Variables are categorized into two types:

(i)User Variables

i
(ii)System Variables

thi
(i)User Variables:

ipa
=>The variables which are related to individual users of Computer

System are known as User Variables.


Ma
=>The information in User variables can be used by only individual

user.
sh
ate

(ii)System Variables:

=>The variables which are related to all the users of Computer system
nk

are known as System Variables.

=>The information in System Variables can be used by all the users


Ve

of Computer System.

--------------------------------------------------------------

faq:

wt is the advantage of having JavaPath in Environment Variables?

=>when we have JavaPath in Environment variables,then we can compile


and execute Java Program from any location of Computer System.

==============================================================

Diagram:

i
thi
ipa
Ma
=============================================================
sh
ate
nk
Ve

You might also like