class Noise {
void makeNoise() {
System.out.println("This is Noise");    
}   
class LessNoise extends Noise {
void makeNoise() {
    System.out.println("This is LessNoise");        
}   
void other() {
    System.out.println("This is a other method in Less Noise");
    }
}
}

 class Casting {


    public static void main(String[] args) {
 ****** Noise [] a= {new Noise() , new LessNoise(), new Noise() };

    }

}

I was trying reference casting.But in star marked line i m getting error that
Multiple markers at this line

  • LessNoise cannot be resolved to a type
  • TODO Auto-generated method stub
  • Line breakpoint:Casting [line: 20] - main

i couldn't able to resolve this error.Anyone help???

You have defined LessNoise inside the class Noise, so you need to refer to it via the Noise class. I guess this is an error in your bracketing, if so, just move the definition of LessNoise outside the Noise class and that should be OK. Indenting your code properly will make this a lot clearer

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.