title: Java - pass object as parameter in constructor
body: <p>My gaol is to use an instance of a class as parameter for another class. I will describe my problem with an example. </p>
  
  <pre><code>public class Color {
  
      public String color;
      public Color (String color) {
          this.color = color;
      }
      public Color grey = new Color("grey");
  }
  </code></pre>
  
  <p>My goal is to build another constructor that uses instances of my fist class as parameters (for example a car):</p>
  
  <pre><code>public class car {
  
      int PS;
      Color color;
  
      public Auto (int PS, Color color) {
          this.PS = PS;
          this.color = color;
      }
  
      public static void main (String args[]) {
          car myCar = new car(80, grey);
  }
  </code></pre>
  
  <p>I get the error "Java cannot find symbol". I tried a lot but can't make it run and I don't fully understand the concepts of classes I guess.</p>