Problem with netbeans | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Problem with netbeans

Hey guys,im just a beginner in programming. there is this simple java code i write on netbeans, and it keeps givin me nonsense errors and hints to fix. And it’s funny because that is the exact same code our teacher wrote on his pc and it was all ok and it ran on netbeans. Is it sth i should’ve done for installing it to avoid these errors?? What should i do? Pls let me know :(

20th Feb 2018, 4:03 PM
Kiana
27 Answers
+ 2
fixed it ... there was more typos 😩 here is your code https://code.sololearn.com/cN7y6b5eGM32/?ref=app
20th Feb 2018, 6:07 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 3
please tell all the errors what are they... whats the console saying..
20th Feb 2018, 4:08 PM
sayan chandra
sayan chandra - avatar
+ 3
You can provide your code and the error message which is occurring. We will be able to deduce something from there.
20th Feb 2018, 4:14 PM
Hatsy Rei
Hatsy Rei - avatar
+ 2
send your code then....
20th Feb 2018, 4:13 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 2
there was too many mistakes in your code (syntax and typos) I modified the code but It still have some problems because it doesn't print any output.. here is the code: https://code.sololearn.com/c044A960EXdO/?ref=app
20th Feb 2018, 5:55 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 2
pay attention to uper case and lower case letters. at one line u used an object in uper case and in another in lower case ....... and don't forget the curly braces 🙂
20th Feb 2018, 6:11 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 2
My sister found it, i just added “static “ in the first public class !!!! Thanks so much again for ur helps 🌺🌺
20th Feb 2018, 7:59 PM
Kiana
+ 1
for your if statements u didn't open curly braces??!
20th Feb 2018, 5:28 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
copy this code in the coding ground and send it's link
20th Feb 2018, 5:30 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
Thank u so much. 💕 Was that all??just typos and syntax erorrs? Oh my god that’s a shame ! 😓 But why it kept telling me to add some nonsense classes ? :|| it runs on sololearn coding ground But i tried the fixed one u gave me on netbens, and again it has some errors :((((
20th Feb 2018, 6:24 PM
Kiana
+ 1
what error? you copied the code in netbeans or wrote them down?
20th Feb 2018, 6:26 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
I copied ur code in the correct places on netbeans, i mean the class is in its place and all.
20th Feb 2018, 6:27 PM
Kiana
+ 1
and what error happened?
20th Feb 2018, 6:29 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
For the first if statement in the class student, it says the if statement is redundant
20th Feb 2018, 6:32 PM
Kiana
+ 1
hold on a minute.... I'm gonna try the code on eclipse......
20th Feb 2018, 6:34 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
okay.... in eclipse (probebly in netbeans too) you must declare the classes (the program class and the student class )in separate files......
20th Feb 2018, 6:44 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
if that's not the problem with your netbeans. u can send me a screenshot of code and error to my email or telegram
20th Feb 2018, 6:45 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
The problem is just with these two lines : S1=new student (); S2=new student (); Error : non-static variable this cannot be referenced from a static context I googled the error, and read lots of answers but found nothing that could help me out
20th Feb 2018, 6:59 PM
Kiana
+ 1
well the code on eclipse had different problems . unfortunately I don't have netbeans.....
20th Feb 2018, 7:02 PM
Farshaad Heydari
Farshaad Heydari - avatar
+ 1
What did it say on elipse??
20th Feb 2018, 7:04 PM
Kiana