Java Fundamentals Flashcards
Type float has _ bits and double type has _ bits
Type float has 32 bits and double type has 64 bits
What does a cast do
Performs an explicit conversion between incompatible data types
What does it mean java is a strongly typed language
it means that the compiler checks all operations for type errors, eg. variables have to adhere to their defined data types
What does static do?
Static allows a member of a class to be used independently of any object of that class
What is a bytecode?
A set of instructions designed to be interpreted by a java virtual machine. Bytecode results from java source code compilation by the java compiler
What is a default constructor
A default constructor is a constructor that takes no arguments
What is boxing
Boxing is the process of encapsulating a value within an object
What is the function of a constructor?
A constructor initializes an object immediately upon creation:
Books myBook = new Books() //object myBook is initialized by the Books constructor
what is this keyword used for
the this keyword is used in a non-static method to refer to the object that invoked the method
What is unboxing
Unboxing is the process of extracting a value from a type wrapper
Why is java considered portable
Its considered portable because of the java bytecode that can run on a jvm, which in turn runs on different platforms
Why is java considered secure
Java is considered secure because java programs are constrained within the jvm, preventing them from generating harmful side effects that run outside of the jvm
What are the 8 primitive java data types
boolean, short, int, float, double, char, byte,long
What are the restrictions faced by methods declared as static?
- They can only call other static methods
- They must access only static data
- They cannot refer to this or super
What are wrappers
Wrappers are classes that encapsulate a primitive type within an object
What is a bytecode?
A set of instructions designed to be interpreted by a java virtual machine. Bytecode results from java source code compilation by the java compiler
Why is java considered portable
Its considered portable because of the java bytecode that can run on a jvm, which in turn runs on different platforms
A string instance variable has a default initial value of _
A string instance variable has a default initial value of NULL
An integer instance variable has a default initial value of _
An integer instance variable has a default initial value of 0
By default, floating-point literals are of type _
By default, floating-point literals are of type double
By default, integer literals are of type _
By default, integer literals are of type int
Characters in java are indices into the _ character set, and they are _ bit values that can be converted into_ and manipulated with _ operators, such as _ and _ operators
Characters in java are indices into the Unicode character set, and they are 16-bit values that can be converted into integers and manipulated integer operators, such as the addition and subtraction operators
Describe \
Backslash
Describe \b
Backspace