What are class variables and instance variables?
Class variable is the variable used in the class, ie class members. Instance variables are the class objects • What is synchronization and why is it important? Synchronization is the way to make our program safe. It is used in multithreading. As we know when we have two or more threads that share a common code there can be some problem like inconsistent of data if one thread is updating data in that code. So if we make that sharable code (common code) synchronized then it ensures that at a given time only one thread will be having rights to access that code. Other threads cant access the code until its free. • How can you force garbage collection? You cant force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately. • Whats the difference between constructors and other methods? Constructors must have the same name as the class and cannot return a value. They are only called once while regular methods could be called many times. • Ex