Thanks!  That is perfect, I know what to do now.  :)

-----Original Message-----
From: Ashok A V [mailto:[email protected]] 
Sent: Saturday, August 08, 2009 3:02 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [java programming] Lab1011

Hi ,

You are required to have methods :

        private static void test(long k) {
                // TODO
                
        }

        private static void test(int i) {
                // TODO
                
        }

which takes long and int respectively :)


Thanks,
Ashok A V

On Sat, Aug 8, 2009 at 9:52 PM, tinyang<[email protected]> wrote:
> Hello
>
> I am trying to complete 3.1 of Lab 1011.  Below is 3.1:
>
> 4. (For your own exercise) Modify TestPassByValue.java as following.  
> Build and run the project.
>
> Pass the second primitive type parameter to the test(..) method - you 
> can choose any primitive type parameter (such as long or boolean).
> Set the value of the second parameter before calling the test(..) method.
> And change the value of the passed parameter within the test(..) 
> method as you did with the first parameter in Code-3.11 above.
> Modify the System.out.println(..) methods in the Code-3.11 above to 
> display the values of both the first parameter and second parameter.
>
> Here is my code:
>
> public class TestPassByValue {
>
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) {
>         // TODO code application logic here
>         int i = 10;
>         long k = 500;
>
>         // Print the value of i
>         System.out.println("start of the main method and i = " + i);
>         System.out.println("start of the main method and k = " + k);
>
>         // Call method test, which is defined below
>         // and pass int value as a parameter.  Since
>         // int is a primitive type, this parameter is passed
>         // by value.
>         test( i );
>         test( k );
>
>         // print the value of i. please note that  i not changed
>         System.out.println("end of the main method and i = " + i);
>         System.out.println("end of the main method and k = " + k);
>     }
>
>     // Another static method in the TestPassByValue class
>     public static void test(int j, long m){
>
>         System.out.println("start of the test method and j = " + j);
>         System.out.println("start of the test method and m = " + m);
>
>         // change value of parameter i
>         j = 33;
>         m = 501;
>
>         System.out.println("end of the test method and j = " + j);
>         System.out.println("end of the test method and m = " + m);
>     }
>
> }
>
> It indicates errors for the following lines test( i ); required Int, 
> long
> found: int
> test( k );
> required Int, long
> found: int
>
> Shouldn't it be able to accept either int or long?  Thanks for any help.
>
> --
> J
> P Please don't print this e-mail unless you really need to.
>
>
> >
>



--
Victory belongs to the most persevering.
 - Napoleon
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.13.24/2255 - Release Date: 8/7/2009
6:37 PM


--~--~---------~--~----~------------~-------~--~----~
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