Core Java Interview Questions
Preparing for a job interview can be nerve-wracking, especially when it comes to technical positions like a Core Java Developer. To help you ace your next interview, here are some common Core Java interview questions you should be prepared to answer:
1. What is Java?
Java is a high-level, object-oriented programming language developed by Sun Microsystems in 1995. It is platform-independent and designed to be easy to use and write once, run anywhere.
2. What are the main features of Java?
Java is known for its features such as platform independence, object-oriented, robust, secure, multithreaded, architecture-neutral, and high-performance.
3. What is the difference between JDK, JRE, and JVM?
JDK (Java Development Kit) is the software development kit used to develop Java applications. JRE (Java Runtime Environment) is used to run Java applications and applets. JVM (Java Virtual Machine) is an abstract machine that provides a runtime environment in which Java bytecode can be executed.
4. What is the difference between an interface and an abstract class?
An interface in Java is a collection of abstract methods. An abstract class can have both abstract methods and concrete methods. An interface can support multiple inheritance, while a class can only extend one superclass.
5. Explain the concept of multithreading in Java.
Multithreading is a feature of Java that allows concurrent execution of two or more parts of a program. It helps in increasing the responsiveness and performance of the program. In Java, multithreading is achieved by extending the Thread class or implementing the Runnable interface.
These are just a few of the many Core Java interview questions you may encounter during an interview. It’s important to thoroughly understand the fundamentals of Java and be prepared to demonstrate your knowledge and problem-solving skills. Good luck!
String concatenation
Why do we use space bar in the second line??
30scriptQA
scriptQA1020
dueto concatenation
Evaulation happens from left to Right in Java.
In case 1, its adding numbers and concat.
In case 2, its concat of strings (str+number and ((str+number)+number).
30 scriptq case 1
Scriptq 1020 case 2
In second case concatenation is happen because compiler thinks it is string
Start with String = string
Start with Int= calculate + string
first int second string
+ is left associative.
Public static void main string args
Public static void main string args
Whatever add in String means that all become String
In 2nd case, it's the concatenation of string and integer.
Jvm read the line of code from left to right
Compiler is performing operation from left to right
It’s all about concatenation. In the first the two added (concatenate) first and then to the string literal.
In the second case, the string literal concatenate first to 10 and 10 concatenate with 20.
Case 1: it sum the both value because Int type value came first that is what java sum both number
Case 2: java read the entire code as a string because it start with string value
Stop wasting your time learning Java. Learn Rust
String +value are concate and value + string is what every values we adding operator operation perform but after string not possible
Because of string baad mai lia haii