java - Why my variables cannot receive a value (interface) -


I have a problem sending values ​​to variables. Why when my input is in value, why can not my variable get the value? I have no idea of ​​doing this ... import java.io. *; Public class student app {public static zero main (string [] args throws IOException {student student object = new grade result}; studentObject.getName (); Student StudentObject 2 = New grade Resolve (); StudentObject2.getIdNum (); Student student object 3 = new grade resal (); studentObject3.getMark (); Student student object 4 = new grade resal (); studentObject4.setName (); Student studentObanks 5 = new grade Ristil (); StudentObject5.setIdNum (); Student student object 6 = new grade resal (); studentObject6.setMark (); Student StudentObject 7 = New grade Result (); StudentObject7.showGrade (); Student Student Object 8 = New grade Resolve (); StudentObject8.showResult (); } Interface student interface {zero getName () throws IOException; Zero getIdNum () throws IOException; Zero setname (); Zero set idnam (); Zero getMark () throws IOException; Zero setmark (); } Interface Student Student Interface (Results of zero showing); Zero show grade (); } Class Grade Result Student {String Name, Name 2, Name 3; Applies; int a, sign; Public zero getName () throws IOException {InputStreamReader inStream = new InputStreamReader (System.in); Buffettder stdin = new buffertder (instream); System.out.print ("Please input your name:"); Name = stdin.readLine (); } Public Zero getIdNum () throws IOException {BufferedReader stdin = new BufferedReader (New InputStreamReader (System.in)); System.out.print ("Please input your ID number:"); Name2 = stdin.readLine (); A = integer Parasent (name 2); } Public Zero Setnam () {System.out.print ("Your Name:" + Name); } Public Zero SetIDNUm () {System.out.print ("\ nYour ID number:" + name2); } Public zero getmark () throws IOException {BufferedReader stdin = new BufferedReader (New InputStreamReader (System.in)); System.out.print ("Please input your mark:"); Name3 = stdin.readLine (); Mark = integer Parasent (name 3); } Public Zero Setmark () {System.out.print ("\ nYour Mark:" + Icon); } Results of public zeros () {if ((Mark> = 40) & amp; amp; (Mark & ​​lt; = 100)) {System.out.print ("\ nYou are near"); } And {System.out.print ("\ nYou have failed"); }} Public Zero Show Grade () (if ((Mark> = 80) & amp; amp; (Mark & ​​lt; = 100)) {System.out.print ("\ n Your grade is one"); } And if ((Mark> = 65) & amp; amp; (Mark & ​​lt; = 80)) {System.out.print ("\ nYour grade is B");} And if ((Symbols & Gt; = 50) & amp; amp; amp; (Symbols & lt; = 65)) {System.out.print ("\ nYour grade is C");} And if ((Mark> = 40) & amp; amp; amp; (Mark & ​​lt; = 50)) {System.out.print ("\ nYour grade is D");} Else {System.out.print ("\ nYour grade is E." );}}}

I'm not sure who is my fault Should use the context reference or just call the main method.

The best solution is to work with your Grade Result class

  Private static string name, name 2, name 3 has to do the following: Private Static Int a, Symbol;   

This will work ..!

Output:

  Please input your name: Mohammed Please enter your ID number: 10001 Please enter your mark input T: 85 Your name: Mohammad your ID number: 10001 Your Mark: 85 your grades you have PASS    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -