Static et non static. Comment faire?
bonjour,
J'ai un code on ne peux plus simple (simplifié au minimum)
Code:
1 2 3 4 5 6 7 8 9 10 11
| public class MyLNReader2 {
public class LineCounter
{
LineCounter (String f){
}
}
public static void main(String[] args) {
new LineCounter("abc");
}
} |
J'ai un problème suivant :
MyLNReader2.java:17: non-static variable this cannot be referenced from a static context
new LineCounter("abc");
^
1 error
1/ Pourquoi?
2/ Comment faire pour créer autant de LineCounter que args.legth et passer des [I]args à la place de "abc" ?
Merci