Misc Flashcards
what are 4 fundamental data types in java
int, float, character, boolean;
size and range of byte in java
1 byte and +127 to -128
size and range of short in java
2 byte and +32767 to -32768
size and range of int in java
4 byte and +x to -(x+1)
size and range of long in java
8 byte and +y to -(y+1)
size of float in java
4 bytes
size of double in java
8 bytes
The letter ‘f’ must follow these type of constants
float type(float and double)
default initial value of int
zero(0)
default initial value of float
zero(0.0)
default initial value of character
NA
default initial value of boolean
false
Two types of programming languages are:
___ oriented and ___ oriented
Procedural and Object
Difference between class and objects
Class exists logically; it has no space allocated in memory to it; is loaded only once in memory while execution; resides in disk as object is allocated space when it is created; based on its parent class definition; reside in main memory
Data members of a class are also known as
properties/fields/attributes
methods of a class are also known as
behaviors/accessories
File name should be the same as the ___ name
Class name; although this is convention and not a rule
Command to execute a java program
java ClassName; make sure that ClassName.class exists so that ClassLoader can put it into main memory.
4 ways to input data to Java program
Keyboard; command prompt; file reading; xml file
Autoboxing/Unboxing is done by ____
Java Compiler
What are default packages and they are imported by whom?
packages that need not be explicitly imported in java programs;
put internally by java compiler
System class belongs to this package
java.lang
Use of this keyword
differentiate between members of class and formal parameters of same name.
obj1.method_name(obj2);
obj1 and obj2 are
source/invoking object, and destination/target object respectively.
5 types of inheritance are
single/multilevel/multiple/hierarchical/hybrid
If we don’t want our class to be inherited, we must define it as ___ class
final class
If we don’t want to give some methods/members of base class to derived class
the must be declared private
Java does not allow ___ classes however ___ ___ classes are allowed
private, and Inner Private
scope of base class object is ___
can access base class objects but not derived class objects.
types of relationships between classes in java
is_a, has_a, and uses_a