I want to call a value from another class but not sure how:
class Angle{
double angleStart;
public Angle(){
angleStart = 0;
Where the value is 0 i want to call in a value entered earlier in the program i gues u use a get command?
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
I want to call a value from another class but not sure how:
class Angle{
double angleStart;
public Angle(){
angleStart = 0;
Where the value is 0 i want to call in a value entered earlier in the program i gues u use a get command?
Thanks for the reply but its not called angle earlier in the programme - i want to call in the value from something else and store it as the new value for angle - is that possible??
Rule is "if u want to call any member of any class then u have to create an object of that class then u can call that variable or method".
Sorry I am not able to understand your problem properly. can u be more specific for your requirement.
i used a value in a variable earlier in the programme called tempPosition and the outputted it - i now want to reuse the original value to do another calculation...sorry im not very good at explaining
Where did you save the original value? If you assign a new value to a variable, the original value is gone.i now want to reuse the original value
Or if the variable is defined locally to a method, when the method exits all its local variables go away.
You also know that sometimes you can use methods that are static without having to instantiate an object right?