Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2256
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Knute Johnson <nospam@knutejohnson.com> |
| Newsgroups | comp.lang.java.help |
| Subject | Re: Wont compile!!! |
| Date | Sat, 10 Nov 2012 20:44:00 -0800 |
| Organization | A noiseless patient Spider |
| Lines | 131 |
| Message-ID | <k7naeg$5e4$1@dont-email.me> (permalink) |
| References | <35e5c178-ae32-4b1b-930e-5ab16276c3dc@googlegroups.com> <k7mqpm$tho$1@dont-email.me> <f869ea35-cb8f-4d89-9035-c9825ae9847f@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Injection-Date | Sun, 11 Nov 2012 04:44:00 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="9b3fcb0d22708969e4dc99e7aa0ef1f9"; logging-data="5572"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18oCkBZA6DYjGtXreQezRWD" |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| In-Reply-To | <f869ea35-cb8f-4d89-9035-c9825ae9847f@googlegroups.com> |
| Cancel-Lock | sha1:FZj/vEaX8zw4zNcrMKYlu9KTsAE= |
| Xref | csiph.com comp.lang.java.help:2256 |
Show key headers only | View raw
On 11/10/2012 4:39 PM, tyrelmatadin921@gmail.com wrote:
> On Saturday, November 10, 2012 7:16:55 PM UTC-5, Knute Johnson
> wrote:
>> On 11/10/2012 4:06 PM, tyrelmatadin921@gmail.com wrote:
>>
>>> This code will not complile and it is really stressing me out.
>>
>>> If someone could help me out i would really apreciate it. thanks
>>> in advanced
>>
>>>
>>
>>> package sheridan;
>>
>>>
>>
>>> import java.util.Scanner;
>>
>>>
>>
>>> public class PayrollStatement
>>
>>> {
>>
>>> PayrollStatement payState = new PayrollStatment();
>>
>>>
>>
>>> payState.printEmployeeName();
>>
>>>
>>
>>> public void printEmployeeName()
>>
>>> {
>>
>>> System.out.println ("Please enter name");
>>
>>> Scanner input = new Scanner(System.in);
>>
>>> String employeeName = input.nextLine();
>>
>>>
>>
>>> payState.isEmpty();
>>
>>>
>>
>>>
>>
>>> }
>>
>>> public boolean isEmpty();
>>
>>> {
>>
>>> String employeeName;
>>
>>> if (employeeName == true)
>>
>>> {
>>
>>> System.out.println ("Not entered");
>>
>>> Scanner input = new Scanner(System.in);
>>
>>> String employeeName = input.nextLine();
>>
>>> }
>>
>>>
>>
>>> }
>>
>>> }
>>
>>>
>>
>>
>>
>> I'm sure it won't. Why don't you show us the error messages and
>> tell us
>>
>> a bit about what it is you are trying to do?
>>
>>
>>
>>
>>
>> --
>>
>>
>>
>> Knute Johnson
> Ensure the name entered by the user is not empty (HINT: a string
> variable is an object which means you can call methods. Search
> JavaDoc for a method that will tell you if a string is empty or not
> (empty string = a string with no characters “”). If the name of the
> employee is empty print “not entered” instead of the name.
>
> 1 error found: File: C:\Users\Turel\Documents\Object-Oriented
> Programing 1\employee payroll\sheridan\PayrollStatement.java [line:
> 9] Error: <identifier> expected
>
> I have been trying to get this program to work for 2 days. ive tried
> every combination i could think of.
>
PayrollStatement is not the same thing as PayrollStatement.
Mis-spellings cause unending problems when you attempt to compile.
The lines;
PayrollStatement paystate = PayrollStatement();
paystate.printEmployeeName();
need to be in the main() method.
public static void main(String[] args) {
PayrollStatement ..............
paystate.pr.................
}
Without a main() it isn't going to run even if it does compile.
You've got another problem with the semi-colon on the end of the
function declaration for isEmpty().
--
Knute Johnson
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Wont compile!!! tyrelmatadin921@gmail.com - 2012-11-10 16:06 -0800
Re: Wont compile!!! Knute Johnson <nospam@knutejohnson.com> - 2012-11-10 16:16 -0800
Re: Wont compile!!! tyrelmatadin921@gmail.com - 2012-11-10 16:39 -0800
Re: Wont compile!!! Knute Johnson <nospam@knutejohnson.com> - 2012-11-10 20:44 -0800
Re: Wont compile!!! Roedy Green <see_website@mindprod.com.invalid> - 2012-11-11 02:51 -0800
Re: Wont compile!!! Joerg Meier <joergmmeier@arcor.de> - 2012-11-11 01:51 +0100
csiph-web