0
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???

Edited by Dani: Formatting fixed

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by JamesCherrill
0

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

Edited by JamesCherrill: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.