Static and non staic reference, Synchronized and unsynchronized, abstarct class,
Hi to all :),
Hope you all will be fine.Actually i want to know the answers of some questions to clear my confusion
- Why we not reference a static method from a non static context. What the reason?
- We say static mean belonging to whole class what is mean by belonging to whole class because it's also possible to make an instance of class and then access static method using object instance?
- What is mean by when we say that HashMap is unsynchronized and Hashtable is synchronized?
- Similarly Vector is synchronized whereas arraylist is not?
- Why we not instantiated abstract class, What's the reason? It is possible to make class abstract without declare any method abstract, so why we declare abstract methods?when we make our class abstarct?
if I have a code like this how can i make a constructor and use super
Code:
public class Car {
private double regularPrice;
private Car(double regularPrice){
this.regularPrice = regularPrice;
}
}
public class Ford extends Car{
private Ford(double regularPrice, int year, int manufacturerdiscount){
super(regularPrice);
this.year = year;
}
}
Means when i use private constructor how can i make instance of it and how i use super keyword to access super class members? Also when we use private constructors?, is it a good programming practice to make constructor private?
Please give me answer of these questions.
Thanks in advance