Java Fundamentals Flashcards
Learn Java fundamentals required to start programming in Java
Difference between JRE and JDK?
JRE is a run time environment required to run Java apps. The end-user will install just JRE to run Java apps. JDK is Java development kit. It provides tools to create Java apps. The developer needs JDK to develop Java apps. JDK installation includes JRE for the developer to create and run Java apps.
Creating and running Java apps?
Source code(*.java) is fed to into JDK which creates Java apps. Java app produced is in byte code format which is an abstraction to run the apps in a platform independent environment. But, that requires a JRE in the host environment to run Java apps.
What are packages in Java?
Package provide organization of file structure. It follows a set of naming convention.
What are the naming conventions for packages?
Package names are all lowercase. Package names create uniqueness, so follow a convention in naming a package to create a global uniqueness. These above are just convention nothing like a hard rule.
How is Package Name and Source File Structure related?
How to execute Java from command line and what are the prerequisites to handle this?
Remember to use full class name including package name. On Windows must include JRE bin folder in the PATH environment variable. Finally, run using Java command.
What are the primitive data types in Java?
Integer Floating point Character Boolean
What are different integer types supported in Java along with their sizes?
Byte - 1 bytes(8 bits, range: -128 to +127) Short - 2 bytes(16 bits, range: -32768 to 32767) Int - 4 bytes(32 bits, range: -2147483648 to 2147483647) Long - 8 bytes(64 bits, range: -9223372036854775808 to 9223372036854775807) Note: for Long, the literal format would be 0L
What are different Floating points supported in Java?
Upload image of floating point
What are different character types supported in Java?
Upload image of character
What is the operator precedence in Java?
Upload image of operator precedence.
How are implicit type conversions done?
Upload image
How are explicit type conversions done in Java?
Upload image
How to initialize an array in Java and how to know it’s length?
Float[] arr = { 1.1, 2.2, 3.1 }; arr.length —> length of array
How is for-each loop used in Java?
Upload image