Tuesday, September 28, 2010

CrazyEngineers Forum - Computer Science & IT Engineering

CrazyEngineers Forum - Computer Science & IT Engineering


problem in java programming

Posted: 27 Sep 2010 09:33 AM PDT

Quote:


class a
{ }

class c extends a
{
c(){System.out.println("class B");}
public void toString()
{
String g="hello";
System.out.println(g);

}

public static void main(String [] arg)
{
a d=new a();
System.out.println(d);

c y=new c();
//System.out.println(d);
System.out.println(y);

}
}

Here is my above program in which i am facing problem.
Here in the above program if we create an object of class a and simply print it then it shows a@1888759 as the output it means that it calls to String() from the Object class and returns the text representation of object of class a but i want to override toString() to print my own text i.e hello here but while executing it gives an error.
So how to override the toString().

Add binary numbers

Posted: 27 Sep 2010 08:44 AM PDT

can anyone tell me that how to add binary numberes in electronic calculator ..

ex: 1000111 + 1111001

No comments:

Post a Comment