Java for Testers – Interview Questions and Answers Part-8 1) What are the additional features in Java 8? – Lambda Expressions: Lambda expressions gives the ability to pass a functionality as a method argument. Lambda expression help us reduce the code clutter in using a single method class. – Pipelines and Streams: Pipeline and streams…
Java for Testers – Interview Questions and Answers Part-7 1. What is threading? – A thread is a lightweight subprocess, the smallest unit of processing. – It is a separate path of execution. – Threads are independent. – If there occurs exception in one thread, it doesn’t affect other threads. – It uses a shared…
Java for Testers – Interview Questions and Answers Part-6 1) How many ways we can define a String in Java? – Using String literal String str = "Automation"; – Using new keyword String str1 = new String("Automation"); – Using Character Array char ch[] = {'A','U','T','O','M','A','T','I','O','N'} String str2 = new String(ch); 2) What is the…
Java for Testers – Interview Questions and Answers Part-5 1) What is the difference between List and Set? – List in Java allows duplicates while Set doesn’t allow duplicates. – List is an Ordered Collection while Set is an unordered Collection. List maintains insertion order of elements, means any element which is inserted before will…
Java for Testers – Interview Questions and Answers Part-4 1) What is the use of static keyword in Main()? Since main() method is the entry point of any Java application, hence making the main() method as static is mandatory for launching the Java application. Since the main method is static, Java virtual Machine can call…
Java for Testers – Interview Questions and Answers Part-3 1) Write a Java program to demonstrate the creation of Interface? // A simple interface interface A { final int a = 10; void display(); } // A class that implements the interface. class TestClass implements A { public void display() { System.out.println("this is an interface");…
Java for Testers – Interview Questions and Answers Part-2 1) Write a Java program to print Floyd’s triangle? public class FloydTriangle { public static void main(String[] args){ Scanner sc = new Scanner(System.in); System.out.println("Enter the number of rows"); int rows = sc.nextInt(); printFloydTriangle(rows); } public static void printFloydTriangle(int n){ int number = 1; for(int i=0;i<n;i++){ for(int…
Java for Testers – Interview Questions and Answers Part-1 1) Write a simple Java program? public class Simple{ public static void main(String[] args){ System.out.println(“Hello World”); } } 2) Write a Java program to print an integer value? public class PrintInteger{ public static void main(String[] args){ int i = 1; System.out.println(i); } } 3) Write a…