FAQ Part 3: Java Syntax and Core Concepts

What are the primitive data types in Java?

Java has 8 primitive data types:

  • byte, short, int, long (integers)
  • float, double (floating-point)
  • char (Unicode character)
  • boolean (true/false)

What is the main method in Java?

public static void main(String[] args)

This is the entry point of any standalone Java program. The JVM looks for this method to start execution.

What is the difference between == and .equals()?

  • ==: Compares memory addresses (reference equality).
  • .equals(): Compares object contents (can be overridden).