4,5,6
4,5,6
Generate random numbers between two given limits using Random class and print
messages according to the range of the value generated.
import java.util.Random;
import java.util.Scanner;
} else {
scanner.close();
1. User Input: The program takes two integer inputs from the user (lower and upper limits).
2. Random Number Generation: The Random class generates a number within the specified
range.
3 Range Classification: The generated number is categorized into three ranges:
4. Output Message: The program prints a message based on where the number falls.
5.Write a program to do String Manipulation using Character Array and perform the
following string operations:
a. String length
b. Finding a character at a particular position
c. Concatenating two strings
import java.util.Scanner;
public class StringManipulation
{
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
// a. String Length
System.out.println("Length of first string: " + charArray1.length);
System.out.println("Length of second string: " + charArray2.length);
scanner.close();
}
}