SivaRamiReddy Reddy

Greenhorn
+ Follow
since Aug 14, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by SivaRamiReddy Reddy

1)abstract class Feline implements Animal { }

1. interface Animal {
2. void eat();
3. }
4.
5. // insert code here
abstract class Feline implements Animal { }
6.
7. public class HouseCat extends Feline {
8. public void eat() { }
9. }


This ok.why means class Feline implements Animal so sub class must be provide the implementation of those methods which are specified in interface.but here we are not prvoding implementation of eat(), so Feline class will become abstract.

2) abstract class Feline implements Animal { void eat(); }

This is not correct.Why means..Feline implements Animal so we have to provide implementation at least empty implementation.

-- Atleat you write like this also..

abstract class Feline implements Animal { abstract public void eat(); }

-- But you dont write like this

abstract class Feline implements Animal { abstract void eat(); }

the reasons is :
You are attempting to assgin waker access priviliges means here access spcifier is default type,but super class Animal's is public so you cant override like this.as well as you cant use private and protected also.


3)abstract class Feline implements Animal { public void eat(); }

So here we sholud write abstract .Why means in interface public and abstract is default.(here overriding is coming)


4) abstract class Feline implements Animal { public void eat() { } }
5) abstract class Feline implements Animal { abstract public void eat(); }
Here 4 and 5 are correct
How do we set our own heap heap memory size
Please can you tell the default java heap
Ya..exactly all the instance reference variables live on heap ..