Capgemini Java interview questions

Capgemini Java interview questions
Download Capgemini Java interview questions PDF

Below are the list of Best Capgemini Java interview questions and Answers

The major features of Java are listed below: –

  • Object-oriented: – Java language is based on object-oriented programming. In this, the class and the methods describe the state and behavior of an object. The programming is done by relating a problem with the real world object.
  • Portable: – the conversion of java program into Java bytecodes take place. This helps in running the program in any environment or platform without any dependency.
  • Platform independent: – java ensures “write once run anywhere” as its programs can be run on multiple platforms like- Windows, Mac, Sun Solaris, Linux, etc.
  • Robust: – java’s strong memory due to no pointer allocations, make it robust. The memory leaks are prohibited with the help of automatic garbage collection in java.
  • Interpreted: – the java code is converted into bytecodes by the java compiler which is then interpreted and executed by the Java interpreter or a just-in-time compiler (JIT).

A number that is divisible by 1 or itself is a Prime Number. 2, 3, 5, 7, 11, 13, 17 are examples of some Prime numbers.

Please Note: 0 and 1 are not a prime number.

Below is a simple Prime number Program in Java to check a number is Prime or Not.

import java.util.Scanner;
public class PrimeExample {
 public static void main(String args[]) {
  int i, m = 0, flag = 0;
  Scanner scan = new Scanner(;
  System.out.print("Enter any number: ");
  // This method reads the number provided using keyboard
  int num = scan.nextInt();
  // Closing Scanner after the use
  m = num / 2;
  if (num == 0 || num == 1) {
   System.out.println(num + " is not prime number");
  } else {
   for (i = 2; i <= m; i++) {
    if (num % i == 0) {
     System.out.println(num + " is not prime number");
     flag = 1;
   if (flag == 0) {
    System.out.println(num + " is prime number");
  } //end of else