Java-lab-qn
Java-lab-qn
Write a Java program that prompts the user for an integer and then prints out all the prime
numbers up to that Integer.
2. Write a program to do String Manipulation using CharacterArray and perform the following
string operations:
a. String length
b. Finding a character at a particular position
c. Concatenating two strings
1. Write a Java program that displays the number of characters, lines and words in a text
2. Write a java program that implements a multi-thread application that has three threads. First
thread check the given number is either even or odd, second thread computes the square of
the number and prints. Third thread will print the value of cube of the number.
1. Generate random numbers using Random class and print messages according to the range of
the value generated.
2. Write a program to perform the following string operations using String class:
a. String Concatenation
b. Search a substring
c. To extract substring from given string
1. Wite a program to demonstrate the use of following exceptions.
a. Arithmetic Exception
b. Number Format Exception
2. Write a program to accept a text and change its size and font. Include bold italic options. Use
frames and controls.
1. Write a Java program that reads on file name from the user, then displays information
about whether the file exists, whether the file is readable, whether the file is writable, the
type of file and the length of the file in bytes.
2. Write a Java program to multiply two given matrices.
1. Write a multi threading program which uses the asynchronous method and Runnable
interface to print the numbers 1to10 using Thread1 and to print 90 to100 using Thread2.
2. Write a Java program that handles all mouse events and shows the event name at the
center of the window when a mouse event is fired. (Use adapter classes).
1. Write a Java program that displays the number of characters, lines and words in a text
2. Write a Java program that handles all mouse events and shows the event name at the
center of the window when a mouse event is fired. (Use adapter classes).
1. Write a Java program that reads on file name from the user, then displays information
about whether the file exists, whether the file is readable, whether the file is writable, the
type of file and the length of the file in bytes.
2. Write a Java program that simulates a traffic light. The program lets the user select
one of three lights: red, yellow, or green with radio buttons. On selecting a button, an
appropriate message with “stop” or “ready” or “go” should appear above the buttons in a
selected color.
1. Write a multi threading program which uses the asynchronous method and Runnable
interface to print the numbers 1to10 using Thread1 and to print 90 to100 using Thread2.
2. Write a program to accept a text and change its size and font. Include bold italic
options. Use frames and controls.
1. Write a Java program that displays the number of characters, lines and words in a text
2. Write a java program that implements a multi-thread application that has three threads. First
thread check the given number is either even or odd, second thread computes the square of
the number and prints. Third thread will print the value of cube of the number.