Ans: Java Virtual Machine (JVM) is the heart of java programming language. JVM is responsible for converting byte code into machine readable code. JVM is not platform independent, thats why you have different JVM for different operating systems. We can customize JVM with Java Options, such as allocating minimum and maximum memory to JVM. It’s called virtual because it provides an interface that doesn’t depend on the underlying OS.
Ans: Write a java program to reverse a given string using recursive method.
Ans: sJava Development Kit (JDK) is for development purpose and JVM is a part of it to execute the java programs.JDK provides all the tools, executables and binaries required to compile, debug and execute a Java Program. The execution part is handled by JVM to provide machine independence.
Ans: Write a java program to create a pyramid of numbers in different patterns.
Ans: Java Runtime Environment (JRE) is the implementation of JVM. JRE consists of JVM and java binaries and other classes to execute any program successfully. JRE doesn’t contain any development tools like java compiler, debugger etc. If you want to execute any java program, you should have JRE installed.
Ans: Write a java program to remove all white spaces from a given string.
Ans: java.lang.Object is the root class for all the java classes and we don’t need to extend it.
Ans: Write a java program to find duplicate characters and their count in a given string. For example, in a string “Better Butter”, duplicate characters and their count is t : 4, e : 3, r : 2 and B : 2.
Ans: Java doesn’t support multiple inheritance in classes because of “Diamond Problem”. To know more about diamond problem with example, read Multiple Inheritance in Java.However multiple inheritance is supported in interfaces. An interface can extend multiple interfaces because they just declare the methods and implementation will be present in the implementing class. So there is no issue of diamond problem with interfaces.
Ans: Write a java program to check the equality of two arrays using different methods.
Ans: Java is not said to be pure object oriented because it support primitive types such as int, byte, short, long etc. I believe it brings simplicity to the language while writing our code. Obviously java could have wrapper objects for the primitive types but just for the representation, they would not have provided any benefit.As we know, for all the primitive types we have wrapper classes such as Integer, Long etc that provides some additional methods.
Ans: Write a java program to check whether two given strings are anagram or not. Two strings are said to be anagram if they contain same set of characters but in different order. For example, “Mother In Law” and “Hitler Woman” are anagram
Ans: PATH is an environment variable used by operating system to locate the executables. That’s why when we install Java or want any executable to be found by OS, we need to add the directory location in the PATH variable. If you work on Windows OS, read this post to learn how to setup PATH variable on Windows.Classpath is specific to java and used by java executables to locate class files. We can provide the classpath location while running java application and it can be a directory, ZIP files, JAR files etc.
Ans: Write a java program to check whether a given number is Armstrong number or not. A number is called an Armstrong number if it is equal to sum of its digits each raised to the power of number of digits in it. For example: 153, 9474, 54748 are some Armstrong numbers.
Ans: main() method is the entry point of any standalone java application. The syntax of main method is public static void main(String args[]).main method is public and static so that java can access it without initializing the class. The input parameter is an array of String through which we can pass runtime arguments to the java program. Check this post to learn how to compile and run java program.
Ans: Write a java program to find duplicate elements in the given array.
Ans: When we have more than one method with same name in a single class but the arguments are different, then it is called as method overloading.Overriding concept comes in picture with inheritance when we have two methods with same signature, one in parent class and another in child class. We can use @Override annotation in the child class overridden method to make sure if parent class method is changed, so as child class.
Ans: Write a java program to find sum of all digits of a given number.
Ans: Write a java program to find second largest number in an array of numbers.
Ans: Write a java program to perform matrix operations like matrix addition, matrix subtraction, matrix multiplication and transpose of a matrix.
You may also interested in...
Core Java Interview Questions And Answers
Java Interview Questions and Answers
Multithreading in Java Interview Questions and Answers
Javascript Interview Questions
Java/J2EE Apps Integration Questions and Answers.
Java Collections Interview Question and Answers
Interview Questions For Selenium with Java
Java Web Services Interview Questions and Answers
Tricky Java Interview Questions and Answers