SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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
 

Tendances (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++
 

Similaire à Wap to implement bitwise operators

Similaire à 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차시
 

Dernier

VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiVIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...Suhani Kapoor
 
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证obuhobo
 
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home MadeDubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Madekojalkojal131
 
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Suhani Kapoor
 
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...robinsonayot
 
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳anilsa9823
 
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...Suhani Kapoor
 
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With RoomVIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Roomdivyansh0kumar0
 
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士obuhobo
 
CALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual serviceanilsa9823
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...Call Girls in Nagpur High Profile
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubaikojalkojal131
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineBruce Bennett
 
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...gurkirankumar98700
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...Suhani Kapoor
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...Suhani Kapoor
 
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service CuttackLow Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service CuttackSuhani Kapoor
 

Dernier (20)

VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Jamshedpur Aishwarya 8250192130 Independent Escort Ser...
 
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service BhilaiVIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
VIP Call Girl Bhilai Aashi 8250192130 Independent Escort Service Bhilai
 
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
VIP High Profile Call Girls Jamshedpur Aarushi 8250192130 Independent Escort ...
 
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
女王大学硕士毕业证成绩单(加急办理)认证海外毕业证
 
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home MadeDubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
Dubai Call Girls Naija O525547819 Call Girls In Dubai Home Made
 
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
Low Rate Call Girls Gorakhpur Anika 8250192130 Independent Escort Service Gor...
 
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
TEST BANK For Evidence-Based Practice for Nurses Appraisal and Application of...
 
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service  🧳
CALL ON ➥8923113531 🔝Call Girls Husainganj Lucknow best Female service 🧳
 
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
 
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With RoomVIP Kolkata Call Girl Lake Gardens 👉 8250192130  Available With Room
VIP Kolkata Call Girl Lake Gardens 👉 8250192130 Available With Room
 
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
内布拉斯加大学林肯分校毕业证录取书( 退学 )学位证书硕士
 
CALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Gosainganj Lucknow best sexual service
 
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...Booking open Available Pune Call Girls Ambegaon Khurd  6297143586 Call Hot In...
Booking open Available Pune Call Girls Ambegaon Khurd 6297143586 Call Hot In...
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
 
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
 
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
(Call Girls) in Lucknow Real photos of Female Escorts 👩🏼‍❤️‍💋‍👩🏻 8923113531 ➝...
 
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
VIP Call Girls in Jamshedpur Aarohi 8250192130 Independent Escort Service Jam...
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
 
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service CuttackLow Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
Low Rate Call Girls Cuttack Anika 8250192130 Independent Escort Service Cuttack
 

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