• Post Reply Bookmark Topic Watch Topic
  • New Topic

Contents on java  RSS feed

 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello , i give exam tomorrow and i would like to give me your opinion Recursion,Upcasting, final,Abstract classes, Downcasting,packages,exceptions,interfaces,generics.What is ''more'' important and i will need it more on this themes ? I know is all but i want to give more ''watch'' on a subjcect which is more important,so what you think?
 
Campbell Ritchie
Marshal
Posts: 55768
163
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What sort of questions are they asking in the exam? What have you been taught? Have you seen last years's exam? You need to know those things before you can decide what is most important to revise.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:What sort of questions are they asking in the exam? What have you been taught? Have you seen last years's exam? You need to know those things before you can decide what is most important to revise.
they ask everything
 
Campbell Ritchie
Marshal
Posts: 55768
163
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nobody asks everything in an exam. There must be a syllabus. They should only ask what has been taught. Have you seen last year's exam? What sort of questions are there? Do you have to write a program in the exam? Do they ask you to describe a particular feature?
We can only help if you tell us those things.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Nobody asks everything in an exam. There must be a syllabus. They should only ask what has been taught. Have you seen last year's exam? What sort of questions are there? Do you have to write a program in the exam? Do they ask you to describe a particular feature?
We can only help if you tell us those things.
it makes questions first(5 questions it can be from all topics ) .If i agree or disagree with the sentence and why i am say this .Example : when you declare a (constructor) as final doesnt allow the creation object out of the class from constructor.
second a code to explain :
third ,is a sort(bubble etc) to explain what it does-not need a code i have prepare for this:

four,to explain what it does :class Mammal {}
class Dog extends Mammal {}
class Cat extends Mammal {}
Mammal m = new Mammal();
Dog d1 = new Dog();
Dog d2 = new Dog();
Cat c1 = new Cat();
Cat c2 = new Dog();
d1 = m;
m = d1;
c1 = d1;
d2 = (Dog)c1;
d2 = m
c1 = (Cat)m;
five,a question : what is difference between abstract and interfacei have asked this here somewhen)
six, a whole exercise it can have polumorphism,sorts,interfaces,abstract class,exceptions everything i refer ..

no hope i think xaxax :P i cross my fingers to go well but i dont be sure i will managed it
 
Campbell Ritchie
Marshal
Posts: 55768
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte spiriopoulos wrote:. . . when you declare a (constructor) as final doesnt allow the creation object out of the class from constructor.
Are they really asking daft things like that? Have you any idea what happens if you declare a constructor as final?
second a code to explain . . .
You will have to go through that code with a pencil and see what the path of execution is. It is not a question I would ask anybody.
four,to explain what it does [/b]:class Mammal {}
. . .
And what do you think will happen there? That is another case where you will have to go through the code with a pencil.
. . .
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Word final as far as I know you cant change the value.In this case means that constructor can't change.At least what I think.Yes they asking things like this..
i will write you some questions-the most of them i cant answer
1)methods like (get) can only ''use'' static values?
2)the Exception class is the ''root'' of lets say ''leading'' of other exceptions
3)the abstract in a variable,doesnt allow to change the value.
4)if Circle ,Triangle,Square make ''more'' the abstract class Shape,which one a,b,c is the right and why?
a. Circle[] circlePin = { new Cirlce(), new Shape(), new Cirlce() };
b. Shape []shapePin = { new Cirlce(), new Square(), new Shape() };
c. Shape[] shapePin2 = { new Cirlce (),new Triangle(), new Square () };
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte spiriopoulos wrote:Word final as far as I know you cant change the value.In this case means that constructor can't change.At least what I think.Yes they asking things like this..


The "final" keyword has different meanings, depending on whether it is applied to a variable, method, or class. So, you can't just use an universal "can't change" rule, as the follow up would be ... can't change what in what context?

Additionally, the "final" keyword isn't applicable in every case... which leads to the next question... does it even apply for constructors?

Henry
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
ekte spiriopoulos wrote:Word final as far as I know you cant change the value.In this case means that constructor can't change.At least what I think.Yes they asking things like this..


The "final" keyword has different meanings, depending on whether it is applied to a variable, method, or class. So, you can't just use an universal "can't change" rule, as the follow up would be ... can't change what in what context?

Additionally, the "final" keyword isn't applicable in every case... which leads to the next question... does it even apply for constructors?

Henry
this is what i find on google
When you set a method as final it means: "You don't want any class override it." But the constructor (according to the Java Language Specification) can't be overridden, so it is clean.
 
Liutauras Vilda
Marshal
Posts: 4657
319
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte spiriopoulos wrote:But the constructor (according to the Java Language Specification) can't be overridden, so it is clean.
So, when you created a test class and tried to compile it:
What did you get?

You can get a lot things answered when you try to execute given examples from your learning material. Give a try and tell us what the answer you can conclude?

Tip: It is a powerful learning technique. When in the next question you will be asked to write a constructor, most likely you'll remember how to do that, only because day or two ago you typed one on your local machine to test if final keyword is permited.
 
ekte spiriopoulos
Ranch Hand
Posts: 217
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liutauras Vilda wrote:
ekte spiriopoulos wrote:But the constructor (according to the Java Language Specification) can't be overridden, so it is clean.
So, when you created a test class and tried to compile it:
What did you get?

You can get a lot things answered when you try to execute given examples from your learning material. Give a try and tell us what the answer you can conclude?

Tip: It is a powerful learning technique. When in the next question you will be asked to write a constructor, most likely you'll remember how to do that, only because day or two ago you typed one on your local machine to test if final keyword is permited.
it tells me on the left ''bar '' from my construcor that " remove invalid 'final' modifier.".Working on Netbeans
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ekte spiriopoulos wrote:this is what i find on google
When you set a method as final it means: "You don't want any class override it." But the constructor (according to the Java Language Specification) can't be overridden, so it is clean.


Can you tell us what you mean by "clean"? Do you mean, since a method is not a constructor, the thing that you found on google is not related to your question?

Henry
 
Liutauras Vilda
Marshal
Posts: 4657
319
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@ekte
Read carefuly this part of JLS.

There is a sentence: "Unlike methods, a constructor cannot be abstract, static, final, native, strictfp, or synchronized". Below you'll find a list of explanations why each of those modifiers are illegal for constructors.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!