Posted in All Posts, Semester 4

Sem 4 – CJ Unit 2 Programs

CJ – Core Java

Unit 2 – Decision Making, Looping, String, Array, Wrapper Classes

1. Write a program to print even number up to 10 using while loop.
Download

2. Write a program to check whether the given number is even or odd.
Download

3. Write a program to demonstrate calculator using switch statement.
Download

4 Write a program to create an array to store 5 integer values. Also initialize the array with 5 numbers and display the array Elements in reverse order.
Download

5. Write a program to create integer array containing 10 values. Then print all the prime numbers contained by the array.
Download

6. Write a program to create a character array to store 6 characters. Also initialize the array with 6 random characters. Now create another array containing 10 characters. Copy the elements ranging from index 2 to 4of first array to second array at the same index.
Download

7. Write a program to sort a list of students on the basis of the marks.
Download

8. Write a java program that accepts a string from users and display each character on separate line in reverse order.
Download (Reverse the string) | Download (Without reversing the string)


9. Write a program to create a string array and sort all the string contained by the array.
Download

10. Write a program to create a string using the string class and check whether the string is a palindrome or not. A string is a palindrome that is spelled the same both forwards and backwards.
Download

Download All Programs

I hope that you found this article to be helpful.
Please share your thoughts in the Comments Section.

Please like our Facebook page to show your support.

Suggested Reading

3 thoughts on “Sem 4 – CJ Unit 2 Programs

  1. Better Solution for program no 8

    import java.util.Scanner;

    public class stringg {
    public static void main(String []args)
    {
    Scanner sc = new Scanner(System.in);
    String s;
    s = sc.next();
    for(int i=s.length()-1; i>=0; i–)
    {
    System.out.println(s.substring(i, i+1));
    }
    }
    }

Comment your thoughts

This site uses Akismet to reduce spam. Learn how your comment data is processed.