Q : What’s the difference between static and public variables ?
A: A static variable belongs to the class rather than an instance of a class. A static method belongs to the class rather than an object of a class. While a public can be accessed from any other class.
Q : Differences between HashMaps and ArrayLists ?
A: HashMaps don’t have a specific order, Hashmaps are organized only thought their keys , and values. Moreover with ArrayLists you are able to get the position of an element with an index(which is based on its position)
Q: What is a Java class ?
A : A Java class is a blueprint that allows for objects to be created .
Q : What is a Java constructor ?
A: A java constructor allows us to initialize variables as soon as we create an object. We can also have two objects calling one constructor .

Q : What are Java attributes ?
A : It’s a field, typically public constant or public variable that can be access directly. Also described as data members, or the variables inside the class/objects
Q : What is Java Inheritance ?
A : Java Inheritance allows different classes to receive all PUBLIC variables and PUBLIC methods. By using the simple keyword ** extends ** . The classes inheriting are subclasses and the class providing is the Super class.
Q : How to overwrite methods that were inherited?
A: by simply re-writing the same method in your desired sub-class

Q : Why should you avoid the finalize() method in the Object class? What are some alternatives?
A: finalize() it is executed by JVM just before the object is being garbage collected. – Java specification will not assured the immediate execution of that finalize method if the object is unreachable – Java language does not specify what thread is the finalizer invoking for an object, so it depends on the implementation of the java vendor. Some vendors may implement it as part of garbage collection thread (or) some may implement it as separate thread. Because of this finalize behavior may vary. – If an uncaught exception is thrown during the finalization, the exception is ignored and finalization of that object terminates.
* Work Around * : You can tell the system to try to run pending finalizers immediately by calling the method System.runFinalization after a garbage collection
key words used : Garbage collection : The process in which java programs perform automatic memory management. When Java programs run on the JVM , objects are created on the heap. Which is a portion of memory dedicated to the program. The garbage collector deletes unused memory. – Java Vendor : Vendor is just the creator/maintainer of the . List of all current java vendors. JVM.https://en.wikipedia.org/wiki/List_of_Java_virtual_machines
“when you don’t create things, you become defined by your tastes rather than ability. your tastes only narrow & exclude people. so create.”
―Jonathan Gillette
Q : Can you change the contents of a final array as shown in the code snippet below?
A : Yes, indeed we can change the contents of the array even if they were marked as final . This is all due to arrays pointing to a particular start location in the memory. This memory address will not changed

Key words used : final : to define an entity that can only be assigned once. – Arrays: An array is a group of the same type variables that are referred to by a common name.
“Talk is cheap. Show me the code.”
― Linus Torvalds
Q : Explain the difference between an interface and an abstract class? When should you use one or the other?
– An interface is a completely “abstract class” that is used to group related methods with empty bodies. – An abstract class : It can have abstract and non-abstract methods (method with the body).
-Variables declared in a Java interface are by default final. An abstract class may contain non-final variables. – A java interface is implemented using the keyword “implements” , and abstract class can be extended using keyword “extends”. – A Interface Class can implement multiple interfaces , abstract class can inherit only one Abstract Class

“Programs must be written for people to read, and only incidentally for machines to execute.”
― Harold Abelson, Structure and Interpretation of Computer Programs
Q : What is polymorphism? Can you give an example?
A : polymorphism is the ability while you’re programming to present the same interface for different underlying forms data types.
Example: in many languages, integers and floats are implicitly polymorphic since you can add, subtract, multiply.Regardless of the fact that the types are different.
Poly = Many : polygon =many-sided, polystyrene = many styrenes -morph = change or form : morphology = study of biological form, Morpheus = the greek god of dreams able to take any form.
“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live”
― John Woods
Q : Can a Semaphore act as a mutex ?
A: A mutex provides mutual exclusion, either producer or consumer can have the key (mutex) and proceed with their work. As long as the buffer is filled by producer, the consumer needs to wait, and vice versa. https://www.geeksforgeeks.org/mutex-vs-semaphore/ A semaphore is a generalized mutex. In lieu of single buffer, we can split the 4 KB buffer into four 1 KB buffers (identical resources). A semaphore can be associated with these four buffers. The consumer and producer can work on different buffers at the same time.
semaphore can potentially act as a mutex if the number of permits it can give out is set to 1. However, one of the biggest differences is that a mutex is owned by the thread acquiring it, till the point, it releases it, whereas for a semaphore there’s no notion of ownership.
Terminology : mutex and semaphore are kernel resources that provide synchronization services.
Q : What is a java method ?
A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method’s name. Think of a method as a subprogram that acts on data and often returns a value.
Each method has its own name. When that name is encountered in a program, the execution of the program branches to the body of that method.
Why is this an important concept for java : Well, good programmers write in a modular fashion which allows for several programmers to work independently on separate concepts which can be assembled at a later date to create the entire project.
Q :How does an instance data value differ from a class data value in Java?
A: An instance data value is defined specifically for objects, while a class data value is defined for classes. An instance data value stores temporary values, while a class data value stores permanent values. An instance data value is defined in the object, while a class data value is…
Q : What is an instance variable ?
Instance variable is the variable declared inside a class, but outside a method:

Now this IronMan Class can be instantiated in other class to use these variables

Q : What’s difference between a public void and a public static void main?
public is an access specifier defining that it can be accessed by any of the classes be it in the same project same/other class, or other project classes. static means that the method is associated with the class, not a specific instance (object) of that class. This means that you can call a static method without creating an object of the class. (Note: whenever you run program, do you need to make object of main method()? Think about it!). void means that the method has no return value. If the method returned an int you would write into instead of void. citation : Prapti Sanghavi, Programmer
Really thought provoking question you posed. I would recommend moving the answer to a newline underneath the question to make it easier to read. Looking forward to learning more from your blog!
LikeLike