Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners write following program
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Amit
write following program
5 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


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?


Advertisement
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 8, 2011 at 6:01 PM




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 program
write 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
write a program in C to print following triangles on the screen
write a program in C to print following triangles on the screen  write a program in C to print following triangles on the screen
Advertisements
Write a java program that prints out the following menu???
Write a java program that prints out the following menu???  Write a java program that prints out the following menu. Auser can interact with the menu using numbers (1,2,3,4,5,6). The menu will be printed again if the user enters
write a java program that implements the following classes:
write a java program that implements the following classes:  write a java program that implements the following classes: A) a) Point in the Cartesian... implements the following methods 1)getArea() method. 2)getVolume() method. B
Write a program named InternetCharge_YourLastName that do the following:
Write a program named InternetCharge_YourLastName that do the following: ... per month unlimited access is provided. Write a program named InternetCharge_YourLastName that do the following: *display the menu as follow: 1. Package A 2
write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n
write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n  write a program to evaluate the following investment equation make use of wrapper class v=p(1+r)rest to n
need a java program for the following
need 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
write a program
write a program  write a program add 2 no.s without use arithmetic,unary operaters in java
C program to print the following
C 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
write a java program
write a java program  write a program to print '*' in a circular form
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
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
WRITE A PROGRAM IN JAVA
WRITE 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 the java program?
write the java program?  1 11 121 1331 14641 15101051
write the java program?
write the java program?  1 11 121 1331 14641 15101051
Write java program?
Write java program?  1 11 121 1331 14641 15101051
Write java program?
Write java program?  1 11 121 1331 14641 15101051
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
program that uses while loops to perform the following steps :
program that uses while loops to perform the following steps :  Write a program that uses while loops to perform the following steps : a. Prompt the use to input two integers : FirstNum and secondNum.( FirstNum must be less
how to write this program
how 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 Beginners
write 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 JAVA
WRITE 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 Beginners
write 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.  
please give me a java program for the following question
please give me a java program for the following question  Write a java program that displays multiple frames : Step 1: Design a frame with three buttons: ?Fruit?, ?Bird? and ?Animal? Step 2: On clicking ?Fruit? button
C Program to Print Following Output - Development process
C Program to Print Following Output  Hello Sir I wnat to print Followning output in C Language with for loop How I Can Print it? 5 5 4 5 4 3 5 4 3 2 5 4 3 2 1  Hi Friend, Try the following: #include
how to write servlet program in eclipse?
how to write servlet program in eclipse?  how to write servlet program in eclipse
How to write calculator in J2ME program?
How to write calculator in J2ME program?  How to write calculator in J2ME program
Write a program to print using for loop
Write a program to print using for loop  Write a program to print using for loop * * * *  
How to write the junit test code for the following controller code
How to write the junit test code for the following controller code  //Controller Code package com.payoda.springs; import java.util.ArrayList; import org.springframework.stereotype.Controller; import
Advertisements
 

 

 

DMCA.com