write following program
Q1 What is the difference between single threaded application and multithreaded application?
What are the benefits of multi-threading. Explain with examples
Q2 Write a java applet that takes your name through a parameter from the HTML file and displays it
Q3 Write a short note on thread synchronization with examples
Q4 WAP that asks the user to input a no. If a no is even then print it else throw a user defined exception
Q5 Draw the state transition diagram of a thread
Q6 Write a java applet that displays 9 squares, one below the other. Every third square must be filled in black?
Q7 What is a package? how is it useful? Demonstrate with example?
Q8 WAP that creates 2 threads. One thread prints your name 1000 times. The other thread calculates the sum of 1st 1000 integers and prints it?
Q9 Draw a diagram of the applet life-cycle?
Q10 WAP that asks the user to input 2 string. If the strings are same it prints "The Strings Are Same" else if throws a user defined exception.
Q11 Explain exception handling features of java with suitable examples?
Q12 What is a java applet? Write a java applet to display "Hello JAVA". Also write the relation between applet and HTML?
Q13 How do you add a class or an interface to a package. Explain with examples?
Q14 Write a short note on Parameter Passing to applets with examples?
View Answers
April 8, 2011 at 5:52 PM
1)
Single-threaded Apartments-Single-threaded apartments consist of exactly one thread, so all COM objects that live in a single-threaded apartment can receive method calls only from the one thread that belongs to that apartment. All method calls to a COM object in a single-threaded apartment are synchronized with the windows message queue for the single-threaded apartment's thread. A process with a single thread of execution is simply a special case of this model.
Multithreaded Apartments-Multithreaded apartments consist of one or more threads, so all COM objects that live in an multithreaded apartment can receive method calls directly from any of the threads that belong to the multithreaded apartment. Threads in a multithreaded apartment use a model called free-threading. Calls to COM objects in a multithreaded apartment are synchronized by the objects themselves."
Java Multithreading
April 8, 2011 at 5:55 PM
2)
Applet Example
3)
Thread Synchronization1
Thread Synchronization2
4)Check Number
import java.util.*;
class Check
{
public static void main(String[] args) throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("Enter a number: ");
int num=input.nextInt();
if(num%2==0){
System.out.println(num+" is even");
}
else{
throw new Exception("Number is odd");
}
}
}
April 9, 2011 at 10:40 AM
10)
import java.util.*;
class AcceptString
{
public static void main(String[] args) throws Exception
{
Scanner input=new Scanner(System.in);
System.out.print("Enter String1: ");
String st1=input.nextLine();
System.out.print("Enter String2: ");
String st2=input.nextLine();
if(st1.equalsIgnoreCase(st2)){
System.out.println("Strings are same!");
}
else{
throw new Exception("String are not equal!");
}
}
}
April 9, 2011 at 10:57 AM
Related Tutorials/Questions & Answers:
write following programwrite following program Q1 What is the difference between single...-threading. Explain with examples
Q2
Write a java applet that takes your name through a parameter from the HTML file and displays it
Q3
Write a short note
Advertisements
write a programwrite a program
write a
program add 2 no.s without use arithmetic,unary operaters in java
need a java program for the followingneed a java
program for the following
Write a java
program with three horizontal sliders. Name the sliders, the first one as red, the second one as green and the third one as blue. You design the
program such that on varying
C program to print the followingC
program to print the following Hello,
Some one help me with a "C
Program" to print the
following as output:
4444444
4333334..., that is why I choosed Java Beginners, but please give me a C
program write a program to print write a
program to print
write a
program to print
following
1 2 3 4 5 4 3 2 1
1 2 3 4 4 3 2 1
1 2 3 3 2 1
1 2 2 1
1 1
core java code for following programcore java code for
following program We are hosting the Olympic games.
Write a
program that will track all the details of this hosting....
The
following are the guidelines while writing this
program
Only command line based
WRITE A PROGRAM IN JAVAWRITE A
PROGRAM IN JAVA
Write program which accepts five students id,name,age,department,courses, taken and its grade.
a. calculate its GPA
. display all student information in ascending order
Write a program in java...Write a
program in java... Hi, friends
Please, can you help me?
Q1:
Write a
program in java to simulate a calculator. Your
program should take two... to enter an integer number.
Write a
program in java to find the factorial
Write a java application program........?Write a java application
program........? Welcome every One :
I have
Q in Java?
Q :
Write a java application
program that reads 20 integer numbers input by the user and prints how many numbers > 100 and how many numbers
how to write this programhow to
write this program
Write a
program in java which calculates... or numerical grade. You will be submitting TWO versions of this
program.
Write one...?¢s GPA. This
program should take a student�s First Name, Last Name a GPA
write a program - Java Beginnerswrite a program 1.
write a
program that reads a string composed of 6 words then generate and print a word composed of the first letters of the 6 words. Hi friend,
Code to solve the problem :
class FirstLetter
WRITE A PROGRAM IN JAVAWRITE A
PROGRAM IN JAVA How do I
write a
program in Java, have the
program display a message with your name in it and a number (Hello john Smith!1) The number must increment from zero to nine, or decrement fron nine to zero. You
write program - Java Beginnerswrite program
write a java
program that will read the values of matrix A and B give its multiplication in matrix C Hi friend,
Code for Matrix Multiplication :
class MatrixMultiplication{
public static void
write a program in java.write a
program in java. arrange the natural n umber in 5x5 matrix as
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
i at centerd position and remaining arrange in anticlockwise direction.
how to write this program? - Java Beginnershow to
write this
program? (game:scissor,rock ,paper) A
program that plays the sciccor-rock-paper game.Revise the
program to let the user continuously play until either the user or the computer wins more than 4 times
to write a program to display the employee details..to
write a
program to display the employee details.. To dipslay... running this
program the new window has to be opened asking us to enter all....
thank you in advance,
madhuri
Have a look at the
following link:
http
how to write the program - Java Beginnershow to
write the program WAP to create the report card user input Name, Class, Division, Roll no., Marks obtained in
following subjects
Lang
Hindi
History
Geography
Math
Phy
Chem.
Bio
Eve
CSTA
Also has a back up
write a program for complete JDBC based application write a
program for complete JDBC based application thank you sir giving answer for my question. my another question is:
Write a complete JDBC based application where in the user supplies the
following table as input
Help me to write this simple java frame program Help me to
write this simple java frame
program I want to
write a Java
program for....
To create a frame with 4 text fields;name,street,city and pin;with suitable labels.
Also add a button "OK". After enter values
write program have product - using loopswrite program have product - using loops
Write a
program...), name (String) and price (double).
Your
program should continue reading new...) of java.lang.Math class
Hi Friend,
Try the
following code:ADS
how do i write a java program for this??how do i
write a java
program for this?? â??Ask the user if they have a dog. If â??yesâ??, ask the user how old is and compute the dogâ??s age... in your
program How to write a program count total pricesHow to
write a
program count total prices Hi. all
I've got a assignment to
write a
program that count total prices of 8 costumers.
class PriceCalculator{
public void method(double quantity)
{
double result