JAVA Programming (314317) Practical Program Codes | Program Codes |

---------------×------------------××--------------------×---------------

Java Programming Image

---------------×------------------××--------------------×---------------

Java Programming (314317)

---------------×------------------××--------------------×---------------


Java Practical Programs

 

1.     Write a program to check multiple conditions using if statement along with logical operators


 

2.     Write a program to check no is even or odd.

import java.util.Scanner;

public class EvenOdd 

{

    public static void main(String[] args) 

    {

        Scanner sc=new Scanner(System.in);

        System.out.print("Enter a number = ");

        int a = sc.nextInt();

        if (a%2==0) 

        {

            System.out.println("Number is Even");

        }

        else

        {

            System.out.println("Number is odd");

        }

    }

}




3.     Write a program to check switch-case using character datatype.

import java.util.Scanner;

public class SwitchCaseEx 

{

    public static void main(String[] args) 

    {

        Scanner sc = new Scanner(System.in);

        System.out.println("Enter one of these character (a,b,c,d) = ");

        String a=sc.next();

        char v= a.charAt(0);

        switch (v) 

        {

            case 'a':

            System.out.println("Uppercase = A");

            break;

            case 'b':

            System.out.println("Uppercase = B");

            break;

            case 'c':

            System.out.println("Uppercase = C");

            break;

            case 'd':

            System.out.println("Uppercase = D");

            break;

            default:

            System.out.println("Invalid character");

            break;

        }

    }

}


 

4.     Write a program to display 1 to 20 numbers using for loop.

public class ForLoopEx 

{

    public static void main(String[] args) 

    {

        for(int i=1;i<21;i++)

        {

            System.out.println(i);

        }

    }

}

 



5.     Write a program to display 1 to 20 numbers using while loop

public class WhileLoopEx 

{

    public static void main(String[] args) 

    {

        int i=1;

        while (i<21) 

        {

            System.out.println(i);

            i++;

        }

    }

}




 6.     Write a program to display 1 to 20 numbers using do while loop.


7. Develop a program to use logical operator in do while loop



8.     Write a program to display The Number on Button from 0 to 9.


9.     Write java program to demonstrate grid of 5*5 (Java AWT and Swing)


10.     Write a program to generate KeyEvent when a key is pressed and display “Key Pressed” message.


11. Write a Program to get Protocol , Path , Host , File , Port of the url using URL Class.




Java Practical Programs


1. Write a program to display 1 to 20 numbers using for, while and do-while loop.


2. Write a program to use different methods of Vector class.


3. Write a program to display array elements using for-each loop.


4. Write a program to perform matrix multiplication.


5. Write a program to convert Integer object value into primitive datatype byte, short and double value.



6. Develop a program to calculate he room area and volume to illustrate the concept of single inheritance.


7. Develop a program to implement the multilevel inheritance.


8. Develop a program to find area of rectangle and circle using interfaces.


9. Develop a program which consists of the package named let_me_calculate with a class named Calculator and a method named add to add two integer numbers. Import let_me_calculate package in another program (class named Demo) to add two numbers.


10.  Develop a program to accept a password from the user and throw “Authentication Failure” Exception if the password is incorrect.



11.     Define an exception called “NotMatchExceptions” that is thrown when a string is not equals to “India”. Write a program that uses this exceptions


12. A. Design an applet/application to demonstrate the use of Radio Button and Checkbox.


B. Design an applet/application to create form using Text Field, Text Area, Button and Label


13. A.  Develop an applet/application using List components to add names of 10 different cities.


B. Develop applet/application to select multiple names of news papers.


14.  Write a program which creates Menu of different colors and disable menu item for Black color.


15.  Write a program to generate KeyEvent when a key is pressed and display “Key Pressed” message


16.  Write a program using URL class to retrieve the host, protocol, port and file of URL http://www.msbte.org.in



Post a Comment

0 Comments