hello all

what is the meaning of :

"Value@a90653"

I just try to print a variable but the result is
"Value@a90653"


thank you
denny

Recommended Answers

All 5 Replies

The is the String returned by the default toString() method. If you want to see something from the Value class add an override to the toString() method to the class and return the string that you want to see.

commented: learned something new :) +9

Hi NormR1 and all
thank for your fast response

here is the code

package c06;
class Value {
  int i = 1;
  public void print() {
    System.out.println(i);
  }
}

public class FinalData1 {
 
  Value v1 = new Value();
  final Value v2 = new Value();
  static final Value v3 = new Value();
   
  public void print(String id) {
    System.out.println(
      id + ": " + "v1 = " + v1 +", v2 = " + v2 + ", v3 = " + v3);
  }
  
  public static void main(String[] args) {
    FinalData1 fd1 = new FinalData1();
    fd1.v2.i++; 
	fd1.print("fd1");
   
  }
}

and what is the meaning of
fd1.v2.i++; at the main ?

thank you
denny

that means that you will augment the value of the i variable in your v2 in your fd1 after executing that line.

Add 1 to the value of the variable "i" in the object "v2" in the object "fd1"
That's why choosing good variable names is an essential skill; finding the shortest way to code something isn't.

Hi NormRI,JamesCheriil and stultuske
thank you for your expalination

denny

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.