Menu

Showing posts with label Java Programming. Show all posts
Showing posts with label Java Programming. Show all posts

What skills do a person need to learn Java?

Java is one of most usable computer programming lanaguge in the world. A person should have basic analytical and problem solving skills to learn the coding.

We have a very good Java book with name "Getting skilled with Java" that will teach everything about Java progamming, and this book will be good to start for a person whom doesn't have any idea about computer progamming or programming language.  

Getting Skilled with Java book demonstrates setting up the development environment and environment variables, installing JDK, writing programs utilizing Java's key capabilities, troubleshooting, deploying the applications, and bundling them. Using Getting Skilled with Java, a person can easily learn java programming from scratch with realistic applications and problem solving programmes. Below are the links from where you could but a Java Book.


BPB get extra discount: https://in.bpbonline.com/products/getting-skilled-with-java

Amazon: https://www.amazon.in/Getting-Skilled-Java-Programming-Applications/dp/9391392490

Flipkart: https://www.flipkart.com/getting-skilled-java/p/itmfc6f8b196897b?pid=9789391392499&lid=LSTBOK97893913924991JRNDH

Why Java doesn't support multiple inheritance?

Java doesn't support multiple inheritance because of deadlock and ambiguity situation.

A class cannot extend two classes, but a class can implement multiple interfaces. So, we use interfaces to achieve multiple inheritance in Java programming.

e.g. Class C extends A, B { //statements }

The above class declaration is invalid in Java programming. but possible in various other programming languages.

e.g. Class C extends A implements D, F { //codes }

The above class declaration is valid in Java. In the above class declaration, we have inherited class A and implementing two interfaces D and F. This way we can implement multiple interfaces in Java.

Example Class C extends Class A and Class B and both classes A and B have evaluate() method. When class C tries to inherit evaluate method then the compiler will get confused and unable to decide which evaluate method to inherit, either from class A or B. So to remove this ambiguity from the program Java doesn't support multiple inheritance.

Can we create an interface without any method?

Yes, we can create an interface without any method. The interface which doesn't have any method or field declaration is called Marker Interface.

Java has few maker interfaces to handling the special scenarios and let the compiler know to treat those classes in a special way. Below are the example of some marker interfaces.