Dear Rohit Bansal:
 
Hi Rohit!  This was a very good insight.  That was a really neat trick.  I hope 
you don't mind if I post to the group.  Thank you.

Respects,

JKid314159
http://existentialists.blogspot.com/

--- On Wed, 7/22/09, Rohit Bansal <[email protected]> wrote:


From: Rohit Bansal <[email protected]>
Subject: Re: [java programming] Lab1027-6.1
To: [email protected]
Date: Wednesday, July 22, 2009, 6:52 PM


Hello, 


I traced out the error.....


1.)
The return type of reflect method is void .... and then you are calling that 
method in 


System.out.println( "This is the new method = " + personAnother3.reflect());


Now when reflect() method won't return anything what should compiler print 
after This is the new method.... 


Hence remember we can never call methods with void return type in printing out 
something BECAUSE WE HAD NOTHING TO PRINT THERE.


2.)
Besides this you are instantiating class in the manner,



 PersonAnother3 personAnother3 =
                new PersonAnother3(10000, 20000, "Sang", "Shin");


Tell me can you trace out the constructor that takes (int,int,String,String) 
values so just declare the constructor with appropriate parameters in 
PersonAnother3 class.


//Correct code



interface PersonInterfaceAnother {   
   void reflect(); 
}


class PersonAnother3 implements PersonInterfaceAnother { 
    public void reflect(){
        System.out.print("New Method placed in PersonAnother3.");
} 
}


class Main{ 
public static void main(String[] args){
     PersonAnother3 personAnother3 =   new PersonAnother3();


System.out.println( "This is the new method = ");
personAnother3.reflect();
} 
}


      
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to