aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Some thoughts for the day! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Some thoughts for the day!" Watch "Some thoughts for the day!" New topic
Author

Some thoughts for the day!

Hemal Mehta
Ranch Hand

Joined: Nov 16, 2000
Posts: 101
Just some thoughts for the day!!
a. An arithmentic operation always results in atleast a int being returned, even if the primitives are byte and short
b. A non abstract sub class always has to implement the abstract methods of the base class.
c. Base class X
Sub class Y
Allowed: Y myY=new X();
Not allowed: X myX=new Y();
d. Continue always takes the loop to the next iteration unlike break which totally comes out of the loop.
e. A base class may not be declared protected or private it is always public
f. Java keywords are always lowercase
Anyways more later...
Harpal Singh
Ranch Hand

Joined: Oct 10, 2000
Posts: 229
Hemal,Hemal,Hemal...
It is the other way round.........
Base class X
Sub class Y
Not Allowed: Y myY=new X();
Allowed: X myX=new Y();
Chk it out.........
Harpal
Nakul Kasadwala
Greenhorn

Joined: Oct 30, 2000
Posts: 22
Hello Hemant,

Always remeber one thing ,
Parent class object can hold object of child class.
e.g.
public class ParentChildClass{
public static void main(String args[]){
ABC a = new XYZ();//line 1
XYZ x = new MNO();//line 2
a = new MNO();//line 3
x = new ABC();//line 4
}
}

class ABC{
int i;
}
class XYZ extends ABC{
int j;
}
class MNO extends XYZ{
int k;
}
Here ABC is parent class so it can hold object of child XYZ.
on line 4 it will throw following error:
"Incompatible type for =. Explicit cast needed to convert ABC to XYZ."
Since MNO is also sub class of ABC line 3 is correct.

 
jQuery in Action, 2nd edition
 
subject: Some thoughts for the day!