Question: I am trying to have a simple design with three nested divs (Div 3 inside Div 2 inside Div 1), each overlaid on top of each other (Div 3 overlaid on Div 2 overlaid on Div 1). The middle div (Div 2) has a certain level of opacity, such that the outermost div (Div 1) is visible to some extent. However, the div which is the top-most div (i.e. Div 3) should be completely visible and the opacity of Div 2 should not affect Div 3. 

Here is the [jsfiddle](https://jsfiddle.net/maverickdebx/cxLcm161/). Child 2's opacity is getting affected by Child 1's opacity, which I don't want to happen. I want Child 2's opacity to be 1.0. How can I do this? Please test on Chrome and Firefox.

Following is the html part:

```
    <html>
     <head>
     </head>
     <body>
       <div class="parent box">
         Parent
         <div class="child box">
           Child
           <div class="child2 box">
             Another Child
           </div>
        </div>
       </div>
     </body>
    </html>

```

Following is the css (note that I need position: absolute for both the children):

```
    .box{
         width:200px;
         height:200px;
     }

    .parent {
         background-color:green;  
    }

    .child {
         background-color:blue;
         left:40px;
         top:40px;
         z-index:10;
         position:absolute;
         opacity:0.35;
     }

     .child2 {
         background-color:green;
         left:40px;
         top:40px;
         z-index:100;
         position:absolute;
      }

```

Answer: 
This should go inside your Card class:

```
@Override
public String toString() {
    return String.valueOf(this.number) + " of " + this.suit;
}

```

Call the function like this:

```
currentCard.toString();

```

or print it out to the console like this:

```
System.out.println(currentCard.toString());

```
toString method doesn't take any arguments and should be inside your card object. It's a string representation of the object. The values are set by the constructor.

Place the suit and high array in your card class at the top with the other variables, so your code looks like this:

```
  int number;
  String cardSuit; //renamed this variable because you have an array with the same name  
  String[] suit = {
      "Clubs",
      "Diamonds",
      "Spades",
      "Hearts"
    };

    String[] high = {
      "Jack",
      "Queen",
      "King"
    };

@Override
public String toString()
{
      String type;

      if (number < 10) {
        type = Integer.toString(number);
      }
      else {
        type = high[i-number];
      }
      return "Suit " + this.suit + " and Number " + this.type;
}

```

Side Note: It's a good idea to make your variables private and use getters/setters to set and access them. Also, override equals as well. If you're using eclipse it can generate it for you automatically.