hi all

i am doing a programing and got stuck on two condition. here is the code that I have done so far. it is as far as i reach.

for(int i=1; i<=3; i++){

           System.out.println("please enter the employee id number");
           emp_idnum = input.nextInt();

           System.out.println("please enter the employee first name");
           empfirst_name = input.next();

           System.out.println("please enter the employee last name");
           emplast_name = input.next();


           public class inputChar()am now getting an error is when i put the semi-colon at the end of the statemnt

           if(inputChar.Equals.('F') || inputChar.Equal('f')){- got a red line that tells me to create a field called public class and when i did

can u tell me what I am missing here.thanks in advance

Recommended Answers

All 12 Replies

Your code as shown is not correct/valid and you aren't showing enough information, such as your class definitions. Are you trying to define a class inside another one?

so what should i do. and how do i define a class

Time to go back to the text book. This is not rocket science, and since you have to ask that question, you haven't been doing your homework... :-(

It looks like inputChar is supposed to be a char that the user inputs? That's not a class that you need to define. It's just like the int and String variables that you have already defined and read from the user.

thanks j

inputChar.Equals.('F') is incorrect, equals method is on intended for string only not for characters

commented: equals is defined in Obect - applies to every class +0

than u noobz32

divinity: don't read noobz32 's response, or, since you did, ignore it. it is wrong.

read James' remark instead. if you read it as a String, use the equals (not Equals) or equalsIgnoreCase method to compare them. if you read your input as a char, use the == operator to compare the values.

ok stultuske thanks I will

hi j

can u please answer me this question. if yuh have ah staement such as this one

inputChar = input.next().CharAt(0);

an u are getting an error underneath the charAt(0), what does does mean and how do u fix it and it is telling u cannot find symbol

CharAt
charAt

see the difference?

ps: full English please - many of our members have English as a second or third language

thanks a lot j

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.