| Author |
What is the output and Why
|
Indravadan T Patel
Greenhorn
Joined: Sep 09, 2007
Posts: 29
|
|
import java.util.Date; public class Example { public static void main(String args[]) { Date d1 = new Date (99, 11, 31); Date d2 = new Date (99, 11, 31); method(d1, d2); System.out.println("d1 is " + d1 + "\nd2 is " + d2); // here is the output } public static void method(Date d1, Date d2) { d2.setYear (100); d1 = d2; // I am confuse by this line } } Regards, Indravadan Patel
|
 |
Amit Ghorpade
Bartender
Joined: Jun 06, 2007
Posts: 2549
|
|
Hi, I would love to reply to your post, but it isn't in the right forum, it has nothing to do with servlets CarefullyChooseOneForum. Someone of the moderators will move it to its right place. I'll post my reply there Hope this helps
|
SCJP, SCWCD.
|Asking Good Questions|
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
What Amit said. Also, it is a little absurd to post code to a forum, asking what the output would be. Why not compile and run it yourself? Tell us what the output is. Then, if there is something you don't understand, ask a more specific question. Moving to Java In General (Beginner)
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Vikas Kapoor
Ranch Hand
Joined: Aug 16, 2007
Posts: 1374
|
|
|
Please spend you bit time here.Java is pass by Value.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: What is the output and Why
|
|
|