Java

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Method Overriding is an example

dynamic binding

dynamic binding uses which information

object

static binding

occurs before run time and remains unchanged throughout program execution

Where are primitive data types stored ?

on Stack

Which method must be implemented by all threads?

run()

Method overloading is an example

static binding

static binding uses what information for binding

type

What is the default value of int variable?

0

What is polymorphism?

Ability of an object to take on many forms. passes more than one "IS-A" test.

Marker Interface

An interface with no methods or fields

Composition

HAS-A relationship Holding the reference of the other class within some other class

finalize()

-executes code just before an object is destroyed by the garbage collector - accepts no arguments - void return type

What is the size of double variable?

64 bit

What is the size of long variable?

64 bit

dynamic binding

In the compile process, certain binding issues can happen "early", but some can only happen during the actual program execution, which are "late" binding. For example, the compiler can detect whether or not an assignment value for a primitive is valid, such as assigning proper values to double variable, but certain Object based assignments may not be, and can only be decided during run time, which is called dynamic or late binding.

local variable

Variables defined inside methods, constructors or blocks

Set Interface

a collection of elements which cannot contain duplicate elements

transient variable

a variable that may not be serialized during Serialization.

What is the default value of Boolean variable?

false

synchronization

the capability to control the access of multiple threads to shared resources.

class variable

A variable that belongs to the class, and is not specific to any particular object, indicated by the word "static", of which only a single copy exists, regardless of how many instances of the class exist.

JRE

JRE is an implementation of the JVM

What is the default value of a local variable?

Not assigned

runtime polymorphism

Occurs at runtime and is used to locate the most recently defined implementation of an overridden method

What happens when thread's yield() method is called?

Thread returns to the ready state.

What happens when thread's sleep() method is called?

Thread returns to the waiting state.

protected access modifier

Variables, methods and constructors which are declared can be accessed by any class lying in same package.

public access modifier

Variables, methods and constructors which are declared can be accessed by any class.

private access modifier

Variables, methods and constructors which are declared can be accessed only by the members of the same class.

What is the default value of byte variable?

0

What is the default value of short variable?

0.0

What is the size of boolean variable?

16 bit

What is the size of char variable?

16 bit

What is the size of short variable?

16 bit

What is the size of float variable?

32 bit

What is the size of int variable?

32 bit

Interface

A collection of constants and abstract methods

What do you need to do in order to run a Java program?

A program must be compiled before objects can be created.

StringBuffer

A string that can be dynamically modified, e.g. mutable. It too has it's own methods for string modification. synchronized.

What invokes a thread's run() method?

After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.

What are Wrapper classes?

Allows for primitives to be inserted into collections or sent over the network. Useful whenever it would be convenient to treat a piece of primitive data as if it were an object.

Which of the following is not a keyword in java?

Boolean

Which of the following stands true about default modifier of class members?

By default, variables, methods and constructors can be accessed by any class lying in the same package.

Which is the way in which a thread can enter the waiting state?

Invoke its suspend(), sleep(), or wait() method.

currentThread()

It is a Thread public static method used to obtain a reference to the current thread.

Encapsulation

Keeping details (like data and procedures) together in one part of a program so that programmers working on other parts of the program don't need to know about them; the technique of making the fields in a class private and providing access to the fields via public methods.

What kind of variables a class can consist of?

Local variable, instance variables and class variables.

What is function overloading?

Methods with same name but different parameters.

garbage collection

Releases memory that was used for a variable's value once the variable is no longer to be used by a program.

What will happen if static modifier is removed from the signature of the main method?

RunTime Error: NoSuchMethodError.

java package

Stored inside a project, a mechanism for organizing Java classes into namespaces, or containers.

Under what conditions is an object's finalize() method invoked by the garbage collector?

When it detects that the object has become unreachable.

What is the default value of char variable?

\u0000

What is a class in java?

a blue print from which individual objects are created; can contain fields and methods to describe the behavior of an object.

applet

a program that runs within another application such as a website

instance variable

a variable defined in a class for which every object of the class has its own value

StringBuilder

allows for dynamic modification of a string. It has it's own methods. unsynchronized

Immutable Object

an object whose state cannot be modified after it is created

try statement

identifies a block of statements that potentially may throw an exception

TreeSet Interface

implemented when we want elements in a sorted order.

JIT

improves the runtime performance of computer programs based on bytecode.

JVM

interpreter for compiled Java bytecodes.

What is the default value of Object variable?

null

What is the default value of String variable?

null

super class

private can be accessed,protected can be accessed by any subclass

What is correct syntax for main method of a java class?

public static void main(String[] args)

final class

the class cannot be inherited to the subclass, methods implemented by that class cannot be overridden

Inheritance

the is-a relationship between a more general superclass and a more specialized subclass

What is Serialization?

the process of converting an object into a sequence of bits so that it can be stored in a file.

NullPointerException

thrown when calling the instance method of a null object or modifying/accessing field of a null object.

static block

used to initialize the static data member., It is excuted before main method at the time of class loading.


Set pelajaran terkait

Life And Health Insurance Chapter 9

View Set

Pressure Injury (Ulcers)- NUR 1014

View Set