|
||
|
|||
|
hi again.
first of all thanks to JavaPF.. now here's my new problem i get this error: Outcome.java:11: setStudNum(int) in Student cannot be applied to (java.lang.String) b.setStudNum("\n0510180"); ^ here's my script Java Code Java Code
public class Student
{
String Name,Course;
int StudentNumber;
public void setNme(String inputName)
{
Name=inputName;
}
public String getNme()
{
return Name;
}
public void setStudNum(int inputStudentNumber)
{
StudentNumber=inputStudentNumber;
}
public int getStudNum()
{
return StudentNumber;
}
public void setCrs(String inputCourse)
{
Course=inputCourse;
}
public String getCrs()
{
return Course;
}
}
Java Code
import java.util.*;
public class Outcome
{
public static void main(String[]args)
{
Student a = new Student();
a.setNme("\nCharles Jaime");
System.out.print(a.getNme());
Student b = new Student();
b.setStudNum("\n0510180");
System.out.print(b.getStudNum());
Student c = new Student();
c.setCrs("\nB.S. Computer Science");
System.out.print(c.getCrs());
}
}
|
|
||||
|
Did you see the update I made here:
http://www.javaprogrammingforums.com...ing-class.html ? Does this solve the problem?
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight] Forum Tip: Add to peoples reputation ( ) by clicking the button on their useful posts.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to convert String to int | JavaPF | Java Code Snippets and Tutorials | 17 | 23-01-2010 01:33 PM |
| [SOLVED] Exception in thread "main" java.lang.NullPointerException | oscardog | Exceptions | 14 | 11-01-2010 09:36 AM |
| Check string is integers only | xeoric | What's Wrong With My Code? | 5 | 21-05-2009 07:45 AM |
| [SOLVED] how to string a number? | Lizard | Loops & Control Statements | 6 | 14-05-2009 08:59 PM |