• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/36

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

36 Cards in this Set

  • Front
  • Back
  • 3rd side (hint)

Advantages of Java

Unique advantage of being write once, and run almost anywhere.



Advantage of being platform independent, because it compiles to bytecode which can run in any platform that has a JVM.

There are two main advantages of Java.

Difference between JDK, JRE, & JVM.

Java Development Kit has everything you need to develop AND run a Java program.



Java Runtime Environment has everything you need to RUN the program.



Java Virtual Machine is what you compiles bytecode runs on.

They all either run a, or run on something. Know the difference.

Difference between class & object

Classes are blueprints for objects.

Classes are the essential.

Is Java pass by reference or value, and what does pass by value mean?

Java is pass by value. Meaning, when you pass an int x to doStuff (int y), you will pass the actual value of x, not set y = x.

It's more direct.

What are primitive types in Java?

byte, int, short, long, char, boolean, float, double

8 types

Types of data types in Java.

Primitive data types, and non-Primitive/ class reference data types.

So easy a caveman could understand it.

Difference between == & .equals () in Java

== is an operator used to compare the content of primitive values. It is not recommended to compare object content because it will compare the object location in memory.



.equals () is a method used to compare 2 objects (such as strings).

They are both used to compare things.

How are reference variable different from primitive variables?

Primitive variables are data types, reference variables are pointers.

One does something the other refers something.

Have you used any version control systems, and which ones have you used?

Git. A component of software configuration management, version control AKA revision control or source control, is the management of changes to documents, computer programs, large web sites, and other collections of information.

Git it.

What is Git?

Version control system for tracking changes in computer files and coordinating work on those files among multiple people.



As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows.

Types of variables in Java

Primitive variables and reference variables

Explain immutability

An object that cannot be changed/modified after it has been created.

Why are Strings immutable in Java?

Security. If strings weren't immutable a connection or file would be changed leading to serious security threats. Mutable Strings could also lead to security problems too, as the parameters are Strings. Synchronization and concurrency makes Strings automatically thread safe. Caching, compiler optimizes string objects, needing only one string object. Class loading, string is used as arguments for class loading, if mutable it could result in wrong class being loaded.

What is .this keyword in Java?

A keyword differentiating the local variable from an instance variable of the same name.

What is string tokenizer?

The string tokenizer can break strings into different sections.

Difference between extends and implements

Extends is used for extending classes to superclasses. Implements is used to extend an interface.

What is autoboxing?

When the compiler automatically converts a primitive variable to its corresponding class version when needed (to us certain class specific methods).

What are wrapper objects?

Wrapper classes are used to convert primitives into objects.

Explain super keyword in Java.

A keyword to call a subclasses parent class.

Method overloading vs. Overriding

Overriding - when extending from a superclass, a subclass can override it's parents method with custom implementation, this happens at runtime.



Overloading - when a class has multiple methods with the same name but different arrangements/number of parameters. This allows you to pass multiple different arrangments/ number of parameters to the same method and still run it. This happens at compile time.



Abstract class vs. Interface and when would you use it?

They are functionally the same thing.



Interface - when each subclass has unique implementation of the methods.



Abstract class - when you have mostly common behavior between subclasses

What does static mean?

Static things are stateless, they do not change for different instances.

What is static block?

A block if code that is excited before any other line of code, including the main method. Static blocks are executed first to last.

What is finally block?

In exception handling of code, a finally block of code is code that will run if an exception was caught or not.

Difference between error and exception.

An error cannot be recovered from, an exception can be. An error would be something like memory running out. An exception would be that a file that is requested cannot be found.

What is recursion?

Iteration will typically use Loops to solve a problem, while a recursive program will call itself again and again until the condition is satisfied.

What is dynamic binding?

Binding which happens at runtime is called Dynamic binding. For example, method overriding is considered Dynamic binding because at runtime it would run the overwritten method.

Can an interface be instantiated in Java?

No.

Is multiple inheritance allowed in Java?

No.

Explain Diamond problem and how does Java solve it?

The diamond problem is when a class extends from 2 parent classes that both extend from another class. In the case that both mediary classes have different implementation of an inherited method. The lowest subclass would not know which method to perform when calling it.



There is no multiple inheritance in Java i e a class can't extend more then one class, yeah there is a concept of interface. A class can implement multiple interfaces, but whenever an interface is implemented it is mandatory for a class to always Implement all its methods. Thus the class will have definition of all the parent methods which avoids problems like deadly diamond in Java.

What is synchronized keyword and why is it used?

In the case of multi-threading in Java, the synchronized keyword ensures that the same method can I be called by two threads at the same time.

Difference between public, private, and protected access modifiers.

Public - Anyone can access.



Default - within package.



Protected - within package and also subclasses in other packages.



Private - only accessible within the class.

Checked vs unchecked exceptions

Checked exceptions are caught by the compiler, unchecked or not. Unchecked exceptions can still be dealt with.

Throws keyword in Java.

The throws keyword informs the compiler that the method may throw an exception.

What is encapsulation?

Encapsulation in Java is a mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.

What is serializable in Java?

Simply speaking, serialization is a process of converting an object into stream of bytes so that it can be transferred over a network or stored in a persistent storage.