Go Back   Java Programming Forums > Java Standard Edition Programming Help > What's Wrong With My Code?


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 23-04-2009, 02:23 PM
Junior Member
 

Join Date: Apr 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
tazjaime is on a distinguished road
Default cannot be applied to (java.lang.String)

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
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());
}
}



Reply With Quote Share this thread on Facebook
Sponsored Links
Java Training from DevelopIntelligence
  #2 (permalink)  
Old 23-04-2009, 03:19 PM
JavaPF's Avatar
mmm.. coffee
 
8 Highscores

Join Date: May 2008
Location: United Kingdom
Posts: 1,543
Thanks: 98
Thanked 92 Times in 85 Posts
JavaPF is someone you want to know!JavaPF is someone you want to know!JavaPF is someone you want to know!

I'm feeling Relaxed
Default Re: cannot be applied to (java.lang.String)

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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


100 most searched terms
Search Cloud
2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?

All times are GMT. The time now is 01:56 AM.
Powered by vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.