File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes please help me Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "please help me" Watch "please help me" New topic
Author

please help me

VIGNESHWAR VISWANATHAN
Greenhorn

Joined: May 26, 2007
Posts: 17
public final class Flaw
{
int age=7;
String name="Bala";
}
class Dflaw extends Flaw
{
public int method()
{
System.out.println("Enter the age=" + age);
System.out.println("Enter the String="

+name);
}}
public static void main(String[] args)
{
Flaw f=new Flaw;
f.age;
f.name;
}
I do not know what is wrong in this ..please post
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
the compiler tells you what is wrong.



are there some parts you do not understand?
Burkhard Hassel
Ranch Hand

Joined: Aug 25, 2006
Posts: 1274
Howdy, cowboys!

First, class Flaw must not be final. Otherwise it cannot be extended.

Second, there are several brackets }} at the wrong places.
To avoid this, use propper indentation of your code. The indentation is visible on the Ranch only if you use the - tag when posting. Do this.

Third: method method is declared to return an int but doesn't.

Number four, with f.name and f.age you are referring to variables but you don't assign anything to it. This is also not possible.

Number five: Your user name should not be in uppercase letters.

By the way: The compiler only shows one error in the first place (15: 'class' or 'interface' expected).
This cryptic message comes from one of the misplaced brackets in the line before. If you remove this error and resave, compiler will tell you more errors.


Yours,
Bu.


all events occur in real time
 
wood burning stoves
 
subject: please help me
 
Similar Threads
cannot find symbol class Dog
Inner class and this ?
variables not found with OOP
constructing object dynamicaly
JOptionPane - showInputDialog