Java Main Features Flashcards

1
Q

What are the main features of Java?

A

a) Object Oriented
b) Simple
c) Platform Independent
d) Secured
e) Robust
f) Portable
g) Multithreaded
h) Distributed
i) dynamic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Simplicity

A

Java is very easy to learn, and its syntax is simple, clean and easy to understand. According to Sun Microsystem, Java language is a simple programming language because:

  • Java syntax is based on C++ (so easier for programmers to learn it after C++).
  • Java has removed many complicated and rarely-used features, for example, explicit pointers, operator overloading, etc.
  • There is no need to remove unreferenced objects because there is an Automatic Garbage Collection in Java.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Object-oriented

A

Java is an object-oriented programming language. Everything in Java is an object. Object-oriented means we organize our software as a combination of different types of objects that incorporate both data and behavior.

Object-oriented programming (OOPs) is a methodology that simplifies software development and maintenance by providing some rules.

Basic concepts of OOPs are:

Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Object(OOP)

A

An entity that has state and behavior is known as an object e.g., chair, bike, marker, pen, table, car, etc. It can be physical or logical (tangible and intangible). The example of an intangible object is the banking system.

An object has three characteristics:

State: represents the data (value) of an object.
Behavior: represents the behavior (functionality) of an object such as deposit, withdraw, etc.
Identity: An object identity is typically implemented via a unique ID. The value of the ID is not visible to the external user. However, it is used internally by the JVM to identify each object uniquely

https://www.javatpoint.com/object-and-class-in-java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Inheritance(OOP)

A

Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is an important part of OOPs (Object Oriented programming system).

The idea behind inheritance in Java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also.

https://www.javatpoint.com/inheritance-in-java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Polymorphism(OOP)

A

Polymorphism in Java is a concept by which we can perform a single action in different ways. Polymorphism is derived from 2 Greek words: poly and morphs. The word “poly” means many and “morphs” means forms. So polymorphism means many forms.

There are two types of polymorphism in Java: compile-time polymorphism and runtime polymorphism. We can perform polymorphism in java by method overloading and method overriding.

If you overload a static method in Java, it is the example of compile time polymorphism. Here, we will focus on runtime polymorphism in java.

https://www.javatpoint.com/runtime-polymorphism-in-java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Abstraction(OOP)

A

Abstraction is a process of hiding the implementation details and showing only functionality to the user.

Another way, it shows only essential things to the user and hides the internal details, for example, sending SMS where you type the text and send the message. You don’t know the internal processing about the message delivery.

Abstraction lets you focus on what the object does instead of how it does it.

https://www.javatpoint.com/abstract-class-in-java

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Encapsulation(OOP)

A

Encapsulation in Java is a process of wrapping code and data together into a single unit, for example, a capsule which is mixed of several medicines.

We can create a fully encapsulated class in Java by making all the data members of the class private. Now we can use setter and getter methods to set and get the data in it.

The Java Bean class is the example of a fully encapsulated class.

https://www.javatpoint.com/encapsulation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Platform Independent

A

Java is platform independent because it is different from other languages like C, C++, etc. which are compiled into platform specific machines while Java is a write once, run anywhere language. A platform is the hardware or software environment in which a program runs.

There are two types of platforms software-based and hardware-based. Java provides a software-based platform.

The Java platform differs from most other platforms in the sense that it is a software-based platform that runs on top of other hardware-based platforms. It has two components:

Runtime Environment
API(Application Programming Interface)
Java code can be executed on multiple platforms, for example, Windows, Linux, Sun Solaris, Mac/OS, etc. Java code is compiled by the compiler and converted into bytecode. This bytecode is a platform-independent code because it can be run on multiple platforms, i.e., Write Once and Run Anywhere (WORA).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Secured

A

Java is best known for its security. With Java, we can develop virus-free systems. Java is secured because:

-No explicit pointer
-Java Programs run inside a virtual machine sandbox
-Classloader: Classloader in Java is a part of the Java Runtime Environment (JRE) which is used to load Java classes into the Java Virtual Machine dynamically. It adds security by separating the package for the classes of the local file system from those that are imported from network sources.
-Bytecode Verifier: It checks the code fragments for illegal code that can violate access rights to objects.
-Security Manager: It determines what resources a class can access such as reading and writing to the local disk.
Java language provides these securities by default. Some security can also be provided by an application developer explicitly through SSL, JAAS, Cryptography, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Robust

A

The English mining of Robust is strong. Java is robust because:

It uses strong memory management.
There is a lack of pointers that avoids security problems.
Java provides automatic garbage collection which runs on the Java Virtual Machine to get rid of objects which are not being used by a Java application anymore.
There are exception handling and the type checking mechanism in Java. All these points make Java robust.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Architecture-neutral

A

Java is architecture neutral because there are no implementation dependent features, for example, the size of primitive types is fixed.

In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32 and 64-bit architectures in Java.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Portable

A

Java is portable because it facilitates you to carry the Java bytecode to any platform. It doesn’t require any implementation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

High-performance

A

Java is faster than other traditional interpreted programming languages because Java bytecode is “close” to native code. It is still a little bit slower than a compiled language (e.g., C++). Java is an interpreted language that is why it is slower than compiled languages, e.g., C, C++, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Distributed

A

Java is distributed because it facilitates users to create distributed applications in Java. RMI and EJB are used for creating distributed applications. This feature of Java makes us able to access files by calling the methods from any machine on the internet.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Multi-threaded

A

A thread is like a separate program, executing concurrently. We can write Java programs that deal with many tasks at once by defining multiple threads. The main advantage of multi-threading is that it doesn’t occupy memory for each thread. It shares a common memory area. Threads are important for multi-media, Web applications, etc.

17
Q

Dynamic

A

Java is a dynamic language. It supports the dynamic loading of classes. It means classes are loaded on demand. It also supports functions from its native languages, i.e., C and C++. Java supports dynamic compilation and automatic memory management (garbage collection).