Results 1 to 5 of 5
Thread: methods and returns
- 03-20-2011, 03:47 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 25
- Rep Power
- 0
- 03-20-2011, 04:06 PM #2
Member
- Join Date
- Mar 2011
- Location
- chennai
- Posts
- 55
- Rep Power
- 0
method return
let consider a program
class Second{
String newMethod(){
return "this is how the value returned";
}
}
class First{
public static void main(String a[]){
Second e=new Second();
System.out.println("returned value - "+e.newMethod());
}
}
after creating the object for Second class the jvm go to execute print statement.
it prints the first string and then immediately we call the method newMethod() so it go to that method, inside that method we returned some value that value is stored in object e. the value in object e displayed on console.
Hope you understand.
- 03-20-2011, 05:30 PM #3
Returning a Value from a Method (The Java™ Tutorials > Learning the Java Language > Classes and Objects)
and the rest of that tutorial trail.
db
- 03-20-2011, 06:20 PM #4
Member
- Join Date
- Mar 2011
- Posts
- 25
- Rep Power
- 0
cheers akiravelmont, that helped a lot
@Darryl.Burke, that didn't, I had already read that tutorial
- 03-21-2011, 09:00 AM #5
Member
- Join Date
- Mar 2011
- Location
- chennai
- Posts
- 55
- Rep Power
- 0
Similar Threads
-
Trouble with static methods and boolean equals() methods with classes
By dreamingofgreen in forum New To JavaReplies: 8Last Post: 04-16-2012, 11:00 PM -
Average returns 0
By jehduncs in forum New To JavaReplies: 2Last Post: 12-03-2010, 06:29 PM -
.DAY_OF_WEEK always returns 7
By shurgs in forum New To JavaReplies: 2Last Post: 08-20-2010, 02:32 PM -
IndexSearch.docfreq returns 0.0
By noir in forum LuceneReplies: 0Last Post: 04-26-2010, 09:32 AM -
What's the need for co-variant returns ?
By ajeeb in forum New To JavaReplies: 0Last Post: 03-23-2009, 09:56 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks