SlideShare a Scribd company logo
1 of 21
1
// WAP to implement bitwise operators.
class Bitwise
{
public static void main(String arg[])
{
int a=3;
int b=6;
int c=a|b;
int d=a&b;
int e=a^b;
int f=(~a & b)|(a & ~b);
int g=~a & 0x0f;
System.out.println(" a=" +a);
System.out.println(" b=" +b);
System.out.println(" a|b=" +c);
System.out.println(" a&b=" +d);
System.out.println(" a^b=" +e);
System.out.println("(~a & b)|(a & ~b)=" +f);
System.out.println(" ~a & 0x0f=" +g);
}
}
OUTPUT
/*
C:sinny>javac Bitwise.java
C:sinny>java Bitwise
a=3
b=6
a|b=7
a&b=2
a^b=5
(~a & b)|(a & ~b)=5
~a & 0x0f=12
*/
2
// WAP to implement arithmetic operator
class Arithmetic
{
public static void main(String arg[])
{
//system.out.println("Integer Arithmetic");
int a=1+1;
int b= a*3;
int c= b/4;
int d= c-a;
int e= -d;
System.out.println("a=" + a);
System.out.println("b=" + b);
System.out.println("c=" + c);
System.out.println("d=" + d);
System.out.println("e=" + e);
}
}
OUTPUT
/*
C:sinny>javac Arithmetic.java
C:sinny>java Arithmetic
a=2
b=6
c=1
d=-1
e=1 */
3
// WAP to implement conditional operator
class conditional
{
public static void main(String arg[])
{
int i,z;
i=10;
z= i<0 ? -i :i; // get absolute value of i
System.out.print("absolute vale of");
System.out.println( i +"is" + z);
i=-10;
z= i<0 ? -i :i; // get absolute value of i
System.out.print("absolute vale of");
System.out.println( i +"is" + z);
}
}
OUTPUT
/*
C:sinny>javac conditional.java
C:sinny>java conditional
absolute vale of10is10
absolute vale of-10is10
*/
4
//WAP to implement constructor overload
class box
{
double width;
double height;
double depth;
box(double w, double h, double d)
{
w=width;
h=height;
d=depth;
}
box()
{
width=-1;
height=-1;
depth=-1;
}
box(double len)
{
width=height=depth=len;
}
double volume()
{
return width*height*depth;
}
}
class overload
{
public static void main(String arg[])
{
box mybox1 = new box(10,20,30);
box mybox2 = new box();
5
box mycube = new box(7);
double vol;
vol=mybox1.volume();
System.out.println("volume of my box1 is " +vol);
vol=mybox2.volume();
System.out.println("volume of my box2 is " +vol);
vol= mycube.volume();
System.out.println("volume of mycube is " +vol);
}
}
OUTPUT
/*
C:sinny>javac overload.java
C:sinny>java overload
volume of my box1 is 0.0
volume of my box2 is -1.0
volume of mycube is 343.0
*/
6
// Prefixincrement and postfix incrementoperators.
public class Increment
{
public static void main( String args[] )
{
int c=5; // assign 5 to c
System.out.println( c ); // prints 5
System.out.println( c++ ); // prints 5 then postincrements
System.out.println( c ); // prints 6
System.out.println(); // skip a line
// demonstrate prefix increment operator
c = 5; // assign 5 to c
System.out.println( c ); // prints 5
System.out.println( ++c ); // preincrements then prints 6
System.out.println( c ); // prints 6
} // end main
} // end class Increment
/*
Output :
C:sinny>javac Increment.java
C:sinny>java Increment
5
5
6
5
6
6*/
7
// Prefixdecrement and postfix decrementoperators.
public class decrement
{
public static void main( String args[] )
{
int c=7; // assign 7 to c
System.out.println( c ); // prints 5
System.out.println( c-- ); // prints 5 then postdecrements
System.out.println( c ); // prints 6
System.out.println(); // skip a line
// demonstrate prefix decrement operator
c = 7; // assign 7 to c
System.out.println( c ); // prints 5
System.out.println( --c ); // predecrements then prints 6
System.out.println( c ); // prints 6
} // end main
} // end class decrement
OUTPUT
/*
C:sinny>javac decrement.java
C:sinny>java decrement
7
7
6
7
6
6 */
8
// WAP to implementmethod overloading.
class overloadDemo
{
void test()
{
System.out.println("Function without parameter");
}
void test(int a) //overload test for one integer parameter.
{
System.out.println("a: "+ a);
}
void test(int a, int b) //overload test for two integer parameter.
{
System.out.println("a and b: " +a + " " + b);
}
double test(double a) //overload test for one double parameter.
{
System.out.println("double a: " +a);
return a*a;
}
}
class overloadmethd
{
public static void main(String args[])
{
overloadDemo ob = new overloadDemo();
double result;
ob.test();
ob.test(10);
ob.test(10,20);
result = ob.test(123.25);
System.out.println("result of ob.test(123.25):" + result);
}
}
9
// Output….
/*
C:sinny>javac overloadmethd.java
C:sinny>java overloadmethd
Function without parameter
a: 10
a and b: 10 20
double a: 123.25
result of ob.test(123.25):15190.5625
*/
10
// WAP to implementrelational operator
import java.util.Scanner;
class evenodd
{
public static void main(String args[])
{
int i=1,n;
Scanner s1=new Scanner(System.in);
System.out.println("Enter the limit for Number :");
n=s1.nextInt();
System.out.println("ODD AND EVEN NUMBERS");
while(i<=n) //relational operator
{
if(i%2==0) //relational operator
{
System.out.println("i = " + i);
}
else
{
System.out.print("i = " + i);
System.out.print(" ");
}
i++;
}
}
}
11
/*
OUTPUT
C:sinny>javac evenodd.java
C:sinny>java evenodd
Enter the limit for
20
ODD AND EVEN NUMBER
i = 1 i = 2
i = 3 i = 4
i = 5 i = 6
i = 7 i = 8
i = 9 i = 10
i = 11 i = 12
i = 13 i = 14
i = 15 i = 16
i = 17 i = 18
i = 19 i = 20
*/
12
// WAP to implementsuper keyword
class Super
{
int x,y;
Super(int a,int b)
{
x=a;
y=b;
}
int area()
{
return x*y;
}
}
class Sub extends Super
{
int z;
Sub(int i,int j,int k)
{
super(i,j);
z=k;
}
int vol()
{
return x*y*z;
}
}
class demosuper
{
public static void main(String args[])
{
Sub s1=new Sub(10,10,20);
System.out.println("Area: " +s1.area());
System.out.println("Volume: " +s1.vol());
}
13
}
OUTPUT
/*
C:sinny>javac demosuper.java
C:sinny>java demosuper
Area: 100
Volume: 2000
*/
14
// WAP A PROGRAM TO SHOW
PATTERN
class pattern
{
int i ;
int j ;
void display()
{
for(i=1; i<=5; i++)
{
for(j=1; j<=i; j++)
{
System.out.print( j ) ;
}
System.out.println(" ") ;
}
}
public static void main(String args[])
{
pattern p = new pattern() ;
p.display();
}
}
15
OUTPUT
/*
C:sinny>javac pattern.java
C:sinny>java pattern
1
12
123
1234
12345
*/
16
// WAP A PROGRAM TO SHOW
PATTERN
class pattern1
{
int i ;
int j ;
void display()
{
for(i=5; i>=0; i--)
{
for(j=i; j<=5; j++)
{
System.out.print( j ) ;
}
System.out.println() ;
}
}
public static void main(String args[])
{
pattern1 p = new pattern1() ;
p.display();
}
}
17
OUTPUT
/*
C:sinny>javac pattern1.java
C:sinny>java pattern1
5
45
345
2345
12345
012345
*/
18
Practical file
Of
JAVA
Submitted To : Submitted By :
Mr. Jainendra Name : Pavleen singh
BCA – Deptt. Roll No :02021202011
Sem : 4nd
sem.
Maharaja Surajmal Institute
19
INDEX
Sr. No Name of Program Page No Sign.
1 WAP TO DEMONSTRATE
BUTTONS IN APPLET
2 WAP TO DEMONSTRATE
CHECKBOX GROUP IN APPLET
3 WAP TO DEMONSTRATE
CHECKBOX IN APPLET
4 WAP TO DEMONSTRATE
CHOICELIST IN APPLET
5
WAP TO DEMONSTRATE
LABELS IN APPLET
6
WAP TO DEMONSTRATE
LIST IN APPLET
7
20
WAP TO DEMONSTRATE
MOVING BANNER IN APPLET
8
WAP TO DEMONSTRATE
GRAPHICS IN APPLET
9
WAP TO DEMONSTRATE
TEXTFIELD IN APPLET
10
WAP TO DEMONSTRATE
MULTITHREAD
11
WAP TO DEMONSTRATE
SCANNER CLASS
12 WAP TO DEMONSTRATE
TEXTFIELD IN SWINGS
21
13
WAP TO DEMONSTRATE
BUTTON IN SWINGS

More Related Content

What's hot

computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9ecomputernotes
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th StudyChris Ohk
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd StudyChris Ohk
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)Sylvain Hallé
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd StudyChris Ohk
 
Diving into byte code optimization in python
Diving into byte code optimization in python Diving into byte code optimization in python
Diving into byte code optimization in python Chetan Giridhar
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADDharmalingam Ganesan
 
C++ Programming - 14th Study
C++ Programming - 14th StudyC++ Programming - 14th Study
C++ Programming - 14th StudyChris Ohk
 
Mangling Ruby with TracePoint
Mangling Ruby with TracePointMangling Ruby with TracePoint
Mangling Ruby with TracePointMark
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Sylvain Hallé
 
Коварный code type ITGM #9
Коварный code type ITGM #9Коварный code type ITGM #9
Коварный code type ITGM #9Andrey Zakharevich
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2goMoriyoshi Koizumi
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked ListSayantan Sur
 
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуdelimitry
 

What's hot (20)

computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9
 
C++ Programming - 4th Study
C++ Programming - 4th StudyC++ Programming - 4th Study
C++ Programming - 4th Study
 
C++ Programming - 3rd Study
C++ Programming - 3rd StudyC++ Programming - 3rd Study
C++ Programming - 3rd Study
 
When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)When RV Meets CEP (RV 2016 Tutorial)
When RV Meets CEP (RV 2016 Tutorial)
 
C++ Programming - 2nd Study
C++ Programming - 2nd StudyC++ Programming - 2nd Study
C++ Programming - 2nd Study
 
Diving into byte code optimization in python
Diving into byte code optimization in python Diving into byte code optimization in python
Diving into byte code optimization in python
 
Load-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOADLoad-time Hacking using LD_PRELOAD
Load-time Hacking using LD_PRELOAD
 
C++ programs
C++ programsC++ programs
C++ programs
 
C++ Programming - 14th Study
C++ Programming - 14th StudyC++ Programming - 14th Study
C++ Programming - 14th Study
 
Mangling Ruby with TracePoint
Mangling Ruby with TracePointMangling Ruby with TracePoint
Mangling Ruby with TracePoint
 
Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings Activity Recognition Through Complex Event Processing: First Findings
Activity Recognition Through Complex Event Processing: First Findings
 
Коварный code type ITGM #9
Коварный code type ITGM #9Коварный code type ITGM #9
Коварный code type ITGM #9
 
Concurrency in Python4k
Concurrency in Python4kConcurrency in Python4k
Concurrency in Python4k
 
All I know about rsc.io/c2go
All I know about rsc.io/c2goAll I know about rsc.io/c2go
All I know about rsc.io/c2go
 
C++ file
C++ fileC++ file
C++ file
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Stack using Linked List
Stack using Linked ListStack using Linked List
Stack using Linked List
 
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему кодуITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
ITGM #9 - Коварный CodeType, или от segfault'а к работающему коду
 
Faster Python, FOSDEM
Faster Python, FOSDEMFaster Python, FOSDEM
Faster Python, FOSDEM
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 

Similar to Wap to implement bitwise operators

Similar to Wap to implement bitwise operators (20)

Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
 
java-programming.pdf
java-programming.pdfjava-programming.pdf
java-programming.pdf
 
Review Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdfReview Questions for Exam 10182016 1. public class .pdf
Review Questions for Exam 10182016 1. public class .pdf
 
Basic program in java
Basic program in java Basic program in java
Basic program in java
 
Java programs
Java programsJava programs
Java programs
 
Java file
Java fileJava file
Java file
 
Java file
Java fileJava file
Java file
 
Oop Presentation
Oop PresentationOop Presentation
Oop Presentation
 
JAVAPGMS.docx
JAVAPGMS.docxJAVAPGMS.docx
JAVAPGMS.docx
 
Hi,I have updated your code. It is working fine now. Highllighted .pdf
Hi,I have updated your code. It is working fine now. Highllighted .pdfHi,I have updated your code. It is working fine now. Highllighted .pdf
Hi,I have updated your code. It is working fine now. Highllighted .pdf
 
My java file
My java fileMy java file
My java file
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
Java doc Pr ITM2
Java doc Pr ITM2Java doc Pr ITM2
Java doc Pr ITM2
 
Assignment no39
Assignment no39Assignment no39
Assignment no39
 
Java Program
Java ProgramJava Program
Java Program
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
 
Java PRACTICAL file
Java PRACTICAL fileJava PRACTICAL file
Java PRACTICAL file
 
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
 

Recently uploaded

原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证
原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证
原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证nhjeo1gg
 
Unlock Your Creative Potential: 7 Skills for Content Creator Evolution
Unlock Your Creative Potential: 7 Skills for Content Creator EvolutionUnlock Your Creative Potential: 7 Skills for Content Creator Evolution
Unlock Your Creative Potential: 7 Skills for Content Creator EvolutionRhazes Ghaisan
 
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一z xss
 
Introduction to phyton , important topic
Introduction to phyton , important topicIntroduction to phyton , important topic
Introduction to phyton , important topicakpgenious67
 
定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一
 定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一 定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一
定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一Fs sss
 
Nathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editorNathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editorNathanBaughman3
 
Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...
Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...
Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...nitagrag2
 
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量sehgh15heh
 
定制英国克兰菲尔德大学毕业证成绩单原版一比一
定制英国克兰菲尔德大学毕业证成绩单原版一比一定制英国克兰菲尔德大学毕业证成绩单原版一比一
定制英国克兰菲尔德大学毕业证成绩单原版一比一z zzz
 
Ch. 9- __Skin, hair and nail Assessment (1).pdf
Ch. 9- __Skin, hair and nail Assessment (1).pdfCh. 9- __Skin, hair and nail Assessment (1).pdf
Ch. 9- __Skin, hair and nail Assessment (1).pdfJamalYaseenJameelOde
 
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCRdollysharma2066
 
格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档
格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档
格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档208367051
 
Black and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdfBlack and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdfpadillaangelina0023
 
LinkedIn for Your Job Search in April 2024
LinkedIn for Your Job Search in April 2024LinkedIn for Your Job Search in April 2024
LinkedIn for Your Job Search in April 2024Bruce Bennett
 
Jumark Morit Diezmo- Career portfolio- BPED 3A
Jumark Morit Diezmo- Career portfolio- BPED 3AJumark Morit Diezmo- Career portfolio- BPED 3A
Jumark Morit Diezmo- Career portfolio- BPED 3Ajumarkdiezmo1
 
美国SU学位证,雪城大学毕业证书1:1制作
美国SU学位证,雪城大学毕业证书1:1制作美国SU学位证,雪城大学毕业证书1:1制作
美国SU学位证,雪城大学毕业证书1:1制作ss846v0c
 
办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书saphesg8
 
Introduction to Political Parties (1).ppt
Introduction to Political Parties (1).pptIntroduction to Political Parties (1).ppt
Introduction to Political Parties (1).pptSohamChavan9
 

Recently uploaded (20)

Students with Oppositional Defiant Disorder
Students with Oppositional Defiant DisorderStudents with Oppositional Defiant Disorder
Students with Oppositional Defiant Disorder
 
原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证
原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证
原版快速办理MQU毕业证麦考瑞大学毕业证成绩单留信学历认证
 
Unlock Your Creative Potential: 7 Skills for Content Creator Evolution
Unlock Your Creative Potential: 7 Skills for Content Creator EvolutionUnlock Your Creative Potential: 7 Skills for Content Creator Evolution
Unlock Your Creative Potential: 7 Skills for Content Creator Evolution
 
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
定制(SCU毕业证书)南十字星大学毕业证成绩单原版一比一
 
Introduction to phyton , important topic
Introduction to phyton , important topicIntroduction to phyton , important topic
Introduction to phyton , important topic
 
定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一
 定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一 定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一
定制(UOIT学位证)加拿大安大略理工大学毕业证成绩单原版一比一
 
Nathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editorNathan_Baughman_Resume_copywriter_and_editor
Nathan_Baughman_Resume_copywriter_and_editor
 
Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...
Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...
Escorts Service Near Surya International Hotel, New Delhi |9873777170| Find H...
 
Young Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort Service
Young Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort ServiceYoung Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort Service
Young Call~Girl in Pragati Maidan New Delhi 8448380779 Full Enjoy Escort Service
 
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
原版定制copy澳洲查尔斯达尔文大学毕业证CDU毕业证成绩单留信学历认证保障质量
 
定制英国克兰菲尔德大学毕业证成绩单原版一比一
定制英国克兰菲尔德大学毕业证成绩单原版一比一定制英国克兰菲尔德大学毕业证成绩单原版一比一
定制英国克兰菲尔德大学毕业证成绩单原版一比一
 
Ch. 9- __Skin, hair and nail Assessment (1).pdf
Ch. 9- __Skin, hair and nail Assessment (1).pdfCh. 9- __Skin, hair and nail Assessment (1).pdf
Ch. 9- __Skin, hair and nail Assessment (1).pdf
 
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
8377877756 Full Enjoy @24/7 Call Girls in Pitampura Delhi NCR
 
格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档
格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档
格里菲斯大学毕业证(Griffith毕业证)#文凭成绩单#真实留信学历认证永久存档
 
Black and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdfBlack and White Minimalist Co Letter.pdf
Black and White Minimalist Co Letter.pdf
 
LinkedIn for Your Job Search in April 2024
LinkedIn for Your Job Search in April 2024LinkedIn for Your Job Search in April 2024
LinkedIn for Your Job Search in April 2024
 
Jumark Morit Diezmo- Career portfolio- BPED 3A
Jumark Morit Diezmo- Career portfolio- BPED 3AJumark Morit Diezmo- Career portfolio- BPED 3A
Jumark Morit Diezmo- Career portfolio- BPED 3A
 
美国SU学位证,雪城大学毕业证书1:1制作
美国SU学位证,雪城大学毕业证书1:1制作美国SU学位证,雪城大学毕业证书1:1制作
美国SU学位证,雪城大学毕业证书1:1制作
 
办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书办理哈珀亚当斯大学学院毕业证书文凭学位证书
办理哈珀亚当斯大学学院毕业证书文凭学位证书
 
Introduction to Political Parties (1).ppt
Introduction to Political Parties (1).pptIntroduction to Political Parties (1).ppt
Introduction to Political Parties (1).ppt
 

Wap to implement bitwise operators

  • 1. 1 // WAP to implement bitwise operators. class Bitwise { public static void main(String arg[]) { int a=3; int b=6; int c=a|b; int d=a&b; int e=a^b; int f=(~a & b)|(a & ~b); int g=~a & 0x0f; System.out.println(" a=" +a); System.out.println(" b=" +b); System.out.println(" a|b=" +c); System.out.println(" a&b=" +d); System.out.println(" a^b=" +e); System.out.println("(~a & b)|(a & ~b)=" +f); System.out.println(" ~a & 0x0f=" +g); } } OUTPUT /* C:sinny>javac Bitwise.java C:sinny>java Bitwise a=3 b=6 a|b=7 a&b=2 a^b=5 (~a & b)|(a & ~b)=5 ~a & 0x0f=12 */
  • 2. 2 // WAP to implement arithmetic operator class Arithmetic { public static void main(String arg[]) { //system.out.println("Integer Arithmetic"); int a=1+1; int b= a*3; int c= b/4; int d= c-a; int e= -d; System.out.println("a=" + a); System.out.println("b=" + b); System.out.println("c=" + c); System.out.println("d=" + d); System.out.println("e=" + e); } } OUTPUT /* C:sinny>javac Arithmetic.java C:sinny>java Arithmetic a=2 b=6 c=1 d=-1 e=1 */
  • 3. 3 // WAP to implement conditional operator class conditional { public static void main(String arg[]) { int i,z; i=10; z= i<0 ? -i :i; // get absolute value of i System.out.print("absolute vale of"); System.out.println( i +"is" + z); i=-10; z= i<0 ? -i :i; // get absolute value of i System.out.print("absolute vale of"); System.out.println( i +"is" + z); } } OUTPUT /* C:sinny>javac conditional.java C:sinny>java conditional absolute vale of10is10 absolute vale of-10is10 */
  • 4. 4 //WAP to implement constructor overload class box { double width; double height; double depth; box(double w, double h, double d) { w=width; h=height; d=depth; } box() { width=-1; height=-1; depth=-1; } box(double len) { width=height=depth=len; } double volume() { return width*height*depth; } } class overload { public static void main(String arg[]) { box mybox1 = new box(10,20,30); box mybox2 = new box();
  • 5. 5 box mycube = new box(7); double vol; vol=mybox1.volume(); System.out.println("volume of my box1 is " +vol); vol=mybox2.volume(); System.out.println("volume of my box2 is " +vol); vol= mycube.volume(); System.out.println("volume of mycube is " +vol); } } OUTPUT /* C:sinny>javac overload.java C:sinny>java overload volume of my box1 is 0.0 volume of my box2 is -1.0 volume of mycube is 343.0 */
  • 6. 6 // Prefixincrement and postfix incrementoperators. public class Increment { public static void main( String args[] ) { int c=5; // assign 5 to c System.out.println( c ); // prints 5 System.out.println( c++ ); // prints 5 then postincrements System.out.println( c ); // prints 6 System.out.println(); // skip a line // demonstrate prefix increment operator c = 5; // assign 5 to c System.out.println( c ); // prints 5 System.out.println( ++c ); // preincrements then prints 6 System.out.println( c ); // prints 6 } // end main } // end class Increment /* Output : C:sinny>javac Increment.java C:sinny>java Increment 5 5 6 5 6 6*/
  • 7. 7 // Prefixdecrement and postfix decrementoperators. public class decrement { public static void main( String args[] ) { int c=7; // assign 7 to c System.out.println( c ); // prints 5 System.out.println( c-- ); // prints 5 then postdecrements System.out.println( c ); // prints 6 System.out.println(); // skip a line // demonstrate prefix decrement operator c = 7; // assign 7 to c System.out.println( c ); // prints 5 System.out.println( --c ); // predecrements then prints 6 System.out.println( c ); // prints 6 } // end main } // end class decrement OUTPUT /* C:sinny>javac decrement.java C:sinny>java decrement 7 7 6 7 6 6 */
  • 8. 8 // WAP to implementmethod overloading. class overloadDemo { void test() { System.out.println("Function without parameter"); } void test(int a) //overload test for one integer parameter. { System.out.println("a: "+ a); } void test(int a, int b) //overload test for two integer parameter. { System.out.println("a and b: " +a + " " + b); } double test(double a) //overload test for one double parameter. { System.out.println("double a: " +a); return a*a; } } class overloadmethd { public static void main(String args[]) { overloadDemo ob = new overloadDemo(); double result; ob.test(); ob.test(10); ob.test(10,20); result = ob.test(123.25); System.out.println("result of ob.test(123.25):" + result); } }
  • 9. 9 // Output…. /* C:sinny>javac overloadmethd.java C:sinny>java overloadmethd Function without parameter a: 10 a and b: 10 20 double a: 123.25 result of ob.test(123.25):15190.5625 */
  • 10. 10 // WAP to implementrelational operator import java.util.Scanner; class evenodd { public static void main(String args[]) { int i=1,n; Scanner s1=new Scanner(System.in); System.out.println("Enter the limit for Number :"); n=s1.nextInt(); System.out.println("ODD AND EVEN NUMBERS"); while(i<=n) //relational operator { if(i%2==0) //relational operator { System.out.println("i = " + i); } else { System.out.print("i = " + i); System.out.print(" "); } i++; } } }
  • 11. 11 /* OUTPUT C:sinny>javac evenodd.java C:sinny>java evenodd Enter the limit for 20 ODD AND EVEN NUMBER i = 1 i = 2 i = 3 i = 4 i = 5 i = 6 i = 7 i = 8 i = 9 i = 10 i = 11 i = 12 i = 13 i = 14 i = 15 i = 16 i = 17 i = 18 i = 19 i = 20 */
  • 12. 12 // WAP to implementsuper keyword class Super { int x,y; Super(int a,int b) { x=a; y=b; } int area() { return x*y; } } class Sub extends Super { int z; Sub(int i,int j,int k) { super(i,j); z=k; } int vol() { return x*y*z; } } class demosuper { public static void main(String args[]) { Sub s1=new Sub(10,10,20); System.out.println("Area: " +s1.area()); System.out.println("Volume: " +s1.vol()); }
  • 14. 14 // WAP A PROGRAM TO SHOW PATTERN class pattern { int i ; int j ; void display() { for(i=1; i<=5; i++) { for(j=1; j<=i; j++) { System.out.print( j ) ; } System.out.println(" ") ; } } public static void main(String args[]) { pattern p = new pattern() ; p.display(); } }
  • 16. 16 // WAP A PROGRAM TO SHOW PATTERN class pattern1 { int i ; int j ; void display() { for(i=5; i>=0; i--) { for(j=i; j<=5; j++) { System.out.print( j ) ; } System.out.println() ; } } public static void main(String args[]) { pattern1 p = new pattern1() ; p.display(); } }
  • 18. 18 Practical file Of JAVA Submitted To : Submitted By : Mr. Jainendra Name : Pavleen singh BCA – Deptt. Roll No :02021202011 Sem : 4nd sem. Maharaja Surajmal Institute
  • 19. 19 INDEX Sr. No Name of Program Page No Sign. 1 WAP TO DEMONSTRATE BUTTONS IN APPLET 2 WAP TO DEMONSTRATE CHECKBOX GROUP IN APPLET 3 WAP TO DEMONSTRATE CHECKBOX IN APPLET 4 WAP TO DEMONSTRATE CHOICELIST IN APPLET 5 WAP TO DEMONSTRATE LABELS IN APPLET 6 WAP TO DEMONSTRATE LIST IN APPLET 7
  • 20. 20 WAP TO DEMONSTRATE MOVING BANNER IN APPLET 8 WAP TO DEMONSTRATE GRAPHICS IN APPLET 9 WAP TO DEMONSTRATE TEXTFIELD IN APPLET 10 WAP TO DEMONSTRATE MULTITHREAD 11 WAP TO DEMONSTRATE SCANNER CLASS 12 WAP TO DEMONSTRATE TEXTFIELD IN SWINGS