Difference between float and double

float double
1. float store smaller range of numbers. 1. double store much larger range of numbers.
2. float requires 4 bytes of memory space. 2. double requires 8 bytes of memory space
3. the data stored in float is in single precision. 3. the data stored in double is in double precision.
4. working with float variable is faster. 4. working with double variable is little bit slower.
5. floating variables by default are not float. 5. floating variables by default are double.
6. Examples:float a=3.1234567f 6. Examples:double b=3.1234567890123456

Difference between Compiler and Interpreter

Compiler Interpreter
1. Compiler is a translator which converts the whole program at a time to machine language. 1. Interpreter is also a translator which converts and executes the program line by line.
2. It displays a list of errors after compilation. 2. It displays an error line by line after compiling each line at a time.
3. Compilation is done before execution of the program. 3. Compilation as well as execution is done simultaneously.
4. Compilation is a fast process. 4. Interpretation is comparatively slower process.
5. Requires more space due to creation of object code. 5. Requires less memory space because it does not create intermediate objects.
6. Debugging is difficult in compiler. 6. Debugging is easy in interpreter.

Difference between postfix and prefix unary operator

postfix prefix
1. the value of the variable is incremented or decremented after it has been evaluated. 1. the value of the variable is incremented or decremented before it is evaluated in the expression
2. post means after i.e. increment/decrement is done after the variable is read. 2. pre means before i.e.increment/decrement first, then used in the expression.
3. int x=20;
System.out.println(x++);
Output : 20
3. int x=20;
System.out.println(++x);
Output : 21

Difference between System.out.print() and System.out.println()

System.out.print() System.out.println()
1. The line does not change after printing the arguments. 1. The line changes after printing the arguments
2. Next output will remain on the same line. 2. Next output will be displayed on the next line.
3. Example:
System.out.print(“AYUSHI”);
System.out.print(“ACADEMY”);
Output: AYUSHIACADEMY
3. Example:
System.out.println(“AYUSHI”);
System.out.println(“ACADEMY”);
Output:
AYUSHI
ACADEMY