Question: ```
class example{ 
    private int x=1;
    public int xreturned(){
    return x;
   }
}
class example2<N>{
    example2<N> variable;
    public int fun(){
        int x=variable.xreturned(); 
    }
}
class mainclass{
    public static void main(String[] args){
       example2<example>obj=new example2<example>();
       if(1.equals(obj.fun()))
       System.out.println("correct");
       return 0;
   }
}

```

at the example2 class in fun function variable cannot find the xreturned() function of class example, how can i make it find it?. Now you may ask me how should it find it? im thinking for being possible to find it as obj has the example (type of example class) generic.. so please tell me how to make it find it with the minimum changes

Answer: 
At runtime there is no way to determine what class was supplied due to [type erasure](http://docs.oracle.com/javase/tutorial/java/generics/erasure.html). In your case it looks like N will always be of the type Example, so your class definition could be 

```
class Example2<N extends Example> 

```

This would make your example work, but I suspect it is probably over simplified to highlight a point (or homework).
In addition to David's answer, and the comment by Anna, here is the complete code (tested)

Note some other changes that I had to do to make it compile (see comments with explanation)

```
class Example{ 
    private int x=1;
    public int xreturned(){
    return x;
   }
}
class Example2<N extends Example> { //as in David's answer
    N variable; //as in Anna's comment
    public int fun(){
        int x=variable.xreturned(); 
        return x;
    }
}
class Mainclass{
    public static void main(String[] args){
       Example2<Example>obj=new Example2<Example>();
       if(1 == obj.fun()) // 1 doesn't have an equals method
           System.out.println("correct"); //indentation added, it's a condition

       //return 0; <-- you can't return 0 from main, it's return type is void
   }
}

```