I am having some trouble with my teacher, we have to master the concepts of java in aabout one month, he is saying that following is possible:
so in Java every class is inheriting from Object class, this class provides us with methods like protected Object clone()
for example: Now let´s say that we have class Car
// later in main:
Car mycar=new Car();
//he is saying now that following is possible:
Car yourCar=(Car) mycar.clone();
but every article online says that this is not possible, even when i try to compile it it's not possible, firstly because the method is protected and secondly because it would throw an exeption
is there something that I am missing ?