First, your methods have no return type, so it won't even compile.
Second, the variables you declare in the methods only exist in that method.
Third, the proper way to declare a nested class would be A.B bb = new A.B() Forth, B does not inherit methods from A, so the if statement won't work.