package credit; public class Credit { String Surname; String Name; public void register(String S,String N) { Surname = S; Name = N; } public void show() { System.out.println("Фамилия "+Name); System.out.println("Имя "+Surname); } } // Это Родитель,здесь нету ошибок package credit2; public class Credit1 extends **Credit** { int Summa; public void register(String S,String N,int sum) { **super.reigster(S,N);** Summa = sum; } public void show() { **;** System.out.println(Summa); } public static void main(String[] args) { **Credit** t1 = new **Credit**(); **Credit** t2 = new **Credit**(); Credit1 t3 = new Credit1(); t1.register("Ivanov","Vasya"); t2.register("Kozlov","Dima"); t3.register("Luchin","Mark");;;; } } 

This is a descendant that I emphasized bold. It gives errors.

  • and what for IDE? Eclipse would correct you ... in general, a notebook just would not correct it - Gorets
  • there is no one there who would beat you in the hands, for the name of the variables beginning with the title? - jmu

3 answers 3

In the credit2 package, enter:

 package credit2; import credit.Credit; //дальше как обычно 


not super.reigster(S,N); , and super.register(S,N);

PS Well, the programmers have gone, they do not even know how to interpret the errors shown by IDE ... Where is the country heading? Punch cards on you not!

  • punched cards?)) yes, schoolchildren no longer know what 3.5 is ... ... =) yes, and this is certainly holivar =), but "guys solve problems," even if the explanations are reduced to "the tyk-tyk-tyk buttons, the red letter became where to click, what would be all good? "=) - Gorets
  • It gives the error "package credit does not exist", I understand that if translated into RU, then such a folder is translated does not exist. PS IDE shows you cant find the symbol, and that's it. - Alibek
  • Mlyn - so you check is in the credit directory file - Barmaley

Error: super.reigster (S, N) -super.register (S, N). And everything seems to be ... at least it works for me ... although the example itself is not entirely clear (meaning) ...

  • PS Sorry, of course, also "import" - barmaglott
  • It gives the error "package credit does not exist", I understand that if translated into RU, then the translated such folder does not exist. - Alibek
  • delete these packages nafig =) re-do them import, throw off classes in one package - Gorets
  • plz Drop off the implementation on NetBeans, and this way I am twisting, EVERYTHING IS EQUALLY SOMETHING NOT THAT (((( - Alibek
  • 2
    @Alibek - well, this is not your campaign. Well, go go to ship tomatoes in the market - it's easier. And if you do not want to ship tomatoes, read a simple tutorial for starters! - Barmaley

In NetBeans, everything is working fine. The error, as previously noted, in the line:

super.reigster (s, n);

Make classes in one package. I would also make an annotation to the method: public void show () in the class Credit1, since you redefine it :) And one more error: you need to swap Name and Surname in the show () method.

  • Oh, this is a minor mistake, I corrected it, Why be so meticulously correct, nobody canceled perseverance))) to come up with a light bulb, 1000 wrong methods were given and 1 of them was correct ... I will learn, then I will show you my works again! !! and your mind everyone will envy SuperHuman (in translation Superman) - Alibek
  • That's right, @Alibek, sculpt. The main thing is more and the most important tasks. Just then, a conversation with the customer about the correction of super-programs will start with 6 zeros (better than Baku ones). - avp
  • @Alibek well, once the answer @SuperHuman liked put him + and accept his answer - so you will be even closer to the caste of progers :) - Barmaley
  • @Alibek, thank you :) This is not meticulousness, but only attention to trifles, which in your code led to errors :) At one time, and I was so sick, but corrected and now it's easier for me :) I noticed correctly about Edison, be more persistent and you will succeed :) - SuperHuman