473,408 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

returns values

when i write the following program---


public class Public_Private
{
public static void main(String args[])
{
Personal Dylan = new Personal();
Dylan.Name(Dylan.name);
Dylan.Birthdate(Dylan.birthdate);
Dylan.Weight(Dylan.weight);
Dylan.Hobbies(Dylan.hobbies);
Dylan.Religion(Dylan.religion);
Dylan.Address(Dylan.address);
Dylan.Visit(Dylan.visit);

}


}
class Personal
{
String name = "Name";
String birthdate = "may 25, 1995";
String weight = "3.5 lbs";
String hobbies = "Sitting, Music, Computers";
String religion = "Freestyle Christian";
String address = "3970 wouldnent you like to know :P";
String visit = "Julliard School Of Fine Arts";
public static String Name(String MyName)
{
System.out.println(MyName);
String name = "Name Method Finished";
return name;
}
public static String Birthdate(String MyBirthdate)
{
System.out.println(MyBirthdate);
String birthdate = "Birthdate method finished";
return birthdate;
}
public static String Weight(String MyWeight)
{
System.out.println(MyWeight);
String weight = "Weight method finished";
return weight;
}
public static String Hobbies(String MyHobbies)
{
System.out.println(MyHobbies);
String hobbies = "Hobbies method finished";
return hobbies;
}
public static String Religion(String MyReligion)
{
System.out.println(MyReligion);
String religion = "Religion method finished";
return religion;
}
public static String Address(String MyAddress)
{
System.out.println(MyAddress);
String address = "Address method finished";
return address;
}
public static String Visit(String MyVisit)
{
System.out.println(MyVisit);
String visit = "visit method finished";
return visit;
}




}

---
Instead of it printing "Name" and then returning the string "name method finished" it just prints "name" and skips the return altogether moving onto the next method call. why cant i get it to return the Strings?
Nov 13 '11 #1
1 1255
Maraj
24
You should do like this and methods will be called one after other because you have written them in sequence.
Expand|Select|Wrap|Line Numbers
  1. String name=Dylan.Name(Dylan.name);
  2.  
  3.  
Now what Name() will return will be stored in name.
Now do same like this for remaining methods.
Nov 13 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David Lloyd | last post by:
When using Network.DNS.Resolve method (or any of trhe other resolution methods) the alias property only returns values when an actual alias is provided as the values to be resolved. Has anyone had...
48
by: Skybuck Flying | last post by:
Hi, I came across this C code which I wanted to understand etc it looked like this: if (-1) etc It made me wonder what the result would be... true or false ? In C and Delphi
0
by: Farooque Khan | last post by:
Hi, I have a web service which returns values by reference and also returns array lists in some cases. I am calling this from a VC 7 application. The problem is that if ANY of the values...
2
by: Do | last post by:
Hi, I have a dataset that returns values. I have done some calculation and 1) want to set the results into a label that I have put into an itemtemplate in a datagrid. 2) Or just set the...
9
by: serge | last post by:
/* Subject: How to build a procedure that returns different numbers of columns as a result based on a parameter. You can copy/paste this whole post in SQL Query Analyzer or Management Studio...
2
by: juster21 | last post by:
I have a form that I have added a button to in the attempt to query my database. I am hoping to be able to generate a SQL statement based on 3 selections that the user makes. Once the SQL runs I...
5
by: cmt | last post by:
I have an ASP report that returns values from a SQL database and formats the data in an HTML table. I am trying to figure out a good way of using CSS to highlight the table row that contains the...
10
by: ++imanshu | last post by:
Hi, Wouldn't it be nicer to have 'in' return values (or keys) for both arrays and dictionaries. Arrays and Dictionaries looked so similar in Python until I learned this difference. Thanks,...
2
by: mcfly1204 | last post by:
What is the best practice for returning values from within a using statement? For instance: using (SqlConnection Conn = new SqlConnection(strConn)) { ...
1
by: munkee | last post by:
I am using a sub routine which returns values in the following way (it is just looking at the ldb of the access file): W7BC-P1595 Admin True Null If there are two users in the back end it...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.