Skip to main content

Posts

Showing posts from March, 2023

Some sample Java programming test questions and answers:

  1. Write a Java program to check if a number is even or odd. solution : import java.util.Scanner; public class Main {     public static void main(String[] args) {         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 {             System.out.println(num + " is odd.");         }     } } 2. Write a Java program to find the largest among three numbers. solution: import java.util.Scanner; public class Main {   ...

Contact Me

Name

Email *

Message *