p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_java thread: RE: Need help with compiler error message!


Message #1 by Jonathan Gold <jonnygee@p...> on Tue, 23 Apr 2002 19:45:55 -0700
This is a multi-part message in MIME format.

------=_NextPart_000_0018_01C1EAFF.7B9050A0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit

Do you have any other copies of LetterCheck2 around? Try getting rid of them
(or change their names).

Maybe that will help.

Jonathan

Jonathan Gold
jonnygee@p...

  -----Original Message-----
  From: Ismael Concepcion [mailto:ripneagle@y...]
  Sent: Tuesday, April 23, 2002 6:11 PM
  To: Beginning Java
  Subject: [beginning_java] RE: Need help with compiler error message!


  Hi Jonathan,

     Thanks for replying to my help request. I noticed the extra quotation
march, which you pointed out to me and I did eliminate it, but the problem
still persists. Even though I tried many times to compile the code, it gave
the same error message over and over again. I tried other files that I have
done previously and they work just fine, but I can't figure out this one.
I'm completely puzzled by this code and I don't know what else I can do.

    Jonathan Gold <jonnygee@p...> wrote:

    Ismael, I copied and pasted the code from your message. There was only
one
    error, and that is the extra quotation mark in the line

    System.out.println("You have the small letter " + symbol");

    Once I took care of that, it compiled fine and it ran fine.

    HTH,

    Jonathan Gold
    jonnygee@p...

    > -----Original Message-----
    > From: Ismael Concepcion [mailto:ripneagle@y...]
    > Sent: Monday, April 22, 2002 6:08 PM
    > To: Beginning Java
    > Subject: [beginning_java] Need help with compiler error message!
    >
    >
    > Hi Ivor,
    >
    > I'm having a problem with this code,
    >
    > public class LetterCheck2
    > {
    > public static void main(String[] args)
    > {
    > char symbol = 'A' ;
    > symbol = (char) (128.0*Math.random( ) ) ;
    >
    > if (symbol >= 'A' && symbol <= 'Z' )
    > System.out.printl Yahoo! Games - play chess, backgammon, pool and
more --- Do you need true END-TO-END (e2e) Java Messaging (JMS)? Softwired
offers industry's ONLY complete 100% JMS messaging solutions for your needs
TODAY. Visit
http://adtracking.wrox.com/track.asp?x=p2p%2Fe%2Fjava%2Dsoftwired&url=www.so
ftwired-inc.com Our unique product range includes: iBus//Mobile (wireless
data), iBus//MessageBus (IP Multicast), iBus//MessageServer (store and
forward) and much more! --- 
http://p2p.wrox.com/manager.asp or 


Message #2 by Ismael Concepcion <ripneagle@y...> on Tue, 23 Apr 2002 18:10:53 -0700 (PDT)
--0-688968806-1019610653=:97328
Content-Type: text/plain; charset=us-ascii


 Hi Jonathan,
   Thanks for replying to my help request. I noticed the extra quotation march, which you pointed out to me and I did eliminate it,
but the problem still persists. Even though I tried many times to compile the code, it gave the same error message over and over
again. I tried other files that I have done previously and they work just fine, but I can't figure out this one. I'm completely
puzzled by this code and I don't know what else I can do. 
  Jonathan Gold <jonnygee@p...> wrote: Ismael, I copied and pasted the code from your message. There was only one
error, and that is the extra quotation mark in the line

System.out.println("You have the small letter " + symbol");

Once I took care of that, it compiled fine and it ran fine.

HTH,

Jonathan Gold
jonnygee@p...

> -----Original Message-----
> From: Ismael Concepcion [mailto:ripneagle@y...]
> Sent: Monday, April 22, 2002 6:08 PM
> To: Beginning Java
> Subject: [beginning_java] Need help with compiler error message!
>
>
> Hi Ivor,
>
> I'm having a problem with this code,
>
> public class LetterCheck2
> {
> public static void main(String[] args)
> {
> char symbol = 'A' ;
> symbol = (char) (128.0*Math.random( ) ) ;
>
> if (symbol >= 'A' && symbol <= 'Z' )
> System.out.println("You have the capital letter " +
> symbol) ;
> else
> if (symbol >= 'a' && symbol <= 'z' )
> System.out.println("You have the small letter " +
> symbol") ;
> else
> System.out.println("The code is not a letter") ;
> }
> } //end of code
>
> which the compiler gives an error message like this:
> LetterCheck2.java:9: 'else' without 'if'
> else
> ^
> This is in Chapter 3, Pg. 80. The book shows a modification to the
> original LetterCheck code. I have tried changing the code but to
> no avail.
> It doesn't compile. Can someone help? Thanks.


---
Do you need true END-TO-END (e2e) Java Messaging (JMS)? Softwired
offers industry's ONLY complete 100% JMS messaging solutions for your
needs TODAY.
Visit http://adtracking.wrox.com/track.asp?x=p2p%2Fe%2Fjava%2Dsoftwired&url=www.softwired-inc.com Our unique product range
includes: iBus//Mobile (wireless data),
iBus//MessageBus (IP Multicast), iBus//MessageServer (store and forward)
and much more!


Have a Jolly Good Day!
Ripneagle@y... Visit my web page at:www.geocities.com/ripneagle

Do You Yahoo!


---------------------------------
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
Message #3 by Jonathan Gold <jonnygee@p...> on Mon, 22 Apr 2002 20:12:45 -0700
Ismael, I copied and pasted the code from your message. There was only one
error, and that is the extra quotation mark in the line

		System.out.println("You have the small letter " + symbol");

Once I took care of that, it compiled fine and it ran fine.

HTH,

Jonathan Gold
jonnygee@p...

> -----Original Message-----
> From: Ismael Concepcion [mailto:ripneagle@y...]
> Sent: Monday, April 22, 2002 6:08 PM
> To: Beginning Java
> Subject: [beginning_java] Need help with compiler error message!
>
>
> Hi Ivor,
>
>    I'm having a problem with this code,
>
> public class LetterCheck2
> {
> 	public static void main(String[] args)
> 	{
> 	     char symbol = 'A' ;
> 	     symbol = (char) (128.0*Math.random( ) ) ;
>
> 	     if (symbol >= 'A' && symbol <= 'Z' )
> 	         System.out.println("You have the capital letter " +
> symbol) ;
> 	     else
>                 if (symbol >= 'a' && symbol <= 'z' )
> 	            System.out.println("You have the small letter " +
> symbol") ;
> 	         else
> 	            System.out.println("The code is not a letter") ;
> 	}
> }  //end of code
>
> which the compiler gives an error message like this:
> LetterCheck2.java:9: 'else' without 'if'
>              else
>              ^
> This is in Chapter 3, Pg. 80. The book shows a modification to the
> original LetterCheck code. I have tried changing the code but to
> no avail.
> It doesn't compile. Can someone help? Thanks.

Message #4 by "Ismael Concepcion" <ripneagle@y...> on Tue, 23 Apr 2002 01:08:29
Hi Ivor,
 
   I'm having a problem with this code, 

public class LetterCheck2
{
	public static void main(String[] args)
	{
	     char symbol = 'A' ;	
	     symbol = (char) (128.0*Math.random( ) ) ;	
					
	     if (symbol >= 'A' && symbol <= 'Z' )		
	         System.out.println("You have the capital letter " + 
symbol) ;
	     else
                if (symbol >= 'a' && symbol <= 'z' ) 	
	            System.out.println("You have the small letter " + 
symbol") ;
	         else     
	            System.out.println("The code is not a letter") ; 
	}
}  //end of code

which the compiler gives an error message like this:     
LetterCheck2.java:9: 'else' without 'if'     
             else
             ^
This is in Chapter 3, Pg. 80. The book shows a modification to the 
original LetterCheck code. I have tried changing the code but to no avail. 
It doesn't compile. Can someone help? Thanks. 
Message #5 by "Ivor Horton" <ivor.horton@b...> on Thu, 25 Apr 2002 10:45:31 +0100
You have a surplus double quote in the statement:

System.out.println("You have the small letter " +
symbol") ;

Ivor

"Ismael Concepcion" <ripneagle@y...> wrote in message
news:167993@b..._java...
>
> Hi Ivor,
>
>    I'm having a problem with this code,
>
> public class LetterCheck2
> {
> public static void main(String[] args)
> {
>      char symbol = 'A' ;
>      symbol = (char) (128.0*Math.random( ) ) ;
>
>      if (symbol >= 'A' && symbol <= 'Z' )
>          System.out.println("You have the capital letter " +
> symbol) ;
>      else
>                 if (symbol >= 'a' && symbol <= 'z' )
>             System.out.println("You have the small letter " +
> symbol") ;
>          else
>             System.out.println("The code is not a letter") ;
> }
> }  //end of code
>
> which the compiler gives an error message like this:
> LetterCheck2.java:9: 'else' without 'if'
>              else
>              ^
> This is in Chapter 3, Pg. 80. The book shows a modification to the
> original LetterCheck code. I have tried changing the code but to no avail.
> It doesn't compile. Can someone help? Thanks.
>
>


Message #6 by Ismael Concepcion <ripneagle@y...> on Thu, 25 Apr 2002 14:33:28 -0700 (PDT)
--0-1526943193-1019770408=:41239
Content-Type: text/plain; charset=us-ascii


 Hello Mr. I. Horton,
   I deleted the surplus quotes in the code and changed the name of the file but when I try to compile the code it gives me 2 error
messages. I don't know what could be wrong. This is the error message I'm getting: java:9: 'else' without 'if' 
                                                               else
                                                               ^
                                                            java:12: 'else' without 'if'
                                                               else
                                                               ^
That is what is going on. If there is anything else I overlooked I'll be more than happy if you point it out for me. Thanks.
 
 
 
                                                                         
                                                         
  Ivor Horton <ivor.horton@b...> wrote: You have a surplus double quote in the statement:

System.out.println("You have the small letter " +
symbol") ;

Ivor

"Ismael Concepcion" wrote in message
news:167993@b..._java...
>
> Hi Ivor,
>
> I'm having a problem with this code,
>
> public class LetterCheck2
> {
> public static void main(String[] args)
> {
> char symbol = 'A' ;
> symbol = (char) (128.0*Math.random( ) ) ;
>
> if (symbol >= 'A' && symbol <= 'Z' )
> System.out.println("You have the capital letter " +
> symbol) ;
> else
> if (symbol >= 'a' && symbol <= 'z' )
> System.out.println("You have the small letter " +
> symbol") ;
> else
> System.out.println("The code is not a letter") ;
> }
> } //end of code
>
> which the compiler gives an error message like this:
> LetterCheck2.java:9: 'else' without 'if'
> else
> ^
> This is in Chapter 3, Pg. 80. The book shows a modification to the
> original LetterCheck code. I have tried changing the code but to no avail.
> It doesn't compile. Can someone help? Thanks.
>
>



---
Do you need true END-TO-END (e2e) Java Messaging (JMS)? Softwired
offers industry's ONLY complete 100% JMS messaging solutions for your
needs TODAY.
Visit http://adtracking.wrox.com/track.asp?x=p2p%2Fe%2Fjava%2Dsoftwired&url=www.softwired-inc.com Our unique product range
includes: iBus//Mobile (wireless data),
iBus//MessageBus (IP Multicast), iBus//MessageServer (store and forward)
and much more!



---------------------------------
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
Message #7 by Jonathan Gold <jonnygee@p...> on Fri, 26 Apr 2002 00:18:40 -0700
This is a multi-part message in MIME format.

------=_NextPart_000_0008_01C1ECB7.EAE17920
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit

Ismael, it would be a good idea to copy and paste the code you now have so
we can catch up.

THX

Jonathan Gold
jonnygee@p...

  -----Original Message-----
  From: Ismael Concepcion [mailto:ripneagle@y...]
  Sent: Thursday, April 25, 2002 2:33 PM
  To: Beginning Java
  Subject: [beginning_java] Re: Need help with compiler error message!


   Hello Mr. I. Horton,

     I deleted the surplus quotes in the code and changed the name of the
file but when I try to compile the code it gives me 2 error messages. I
don't know what could be wrong. This is the error message I'm getting:
java:9: 'else' without 'if'

                                                                 else

                                                                 ^

                                                              java:12:
'else' without 'if'

                                                                 else

                                                                 ^

  That is what is going on. If there is anything else I overlooked I'll be
more than happy if you point it out for me. Thanks.











    Ivor Horton <ivor.horton@b...> wrote:

    You have a surplus double quote in the statement:

    System.out.println("You have the small letter " +
    symbol") ;

    Ivor

    "Ismael Concepcion" wrote in message
    news:167993@b..._java...
    >
    > Hi Ivor,
    >
    > I'm having a problem with this code,
    >
    > public class LetterCheck2
    > {
    > public static void main(String[] args)
    > {
    > char symbol = 'A' ;
    > symbol = (char) (128.0*Math.random( ) ) ;
    >
    > if (symbol >= 'A' && symbol <= 'Z' )
    > System.out.println("You have the capital letter " +
    > symbol) ;
    > else
    > if (symbol >= 'a' && symbol <= 'z' )
    > System.out.println("You have the small letter " +
    > symbol") ;
    > else
    > System.out.println("The code is not a letter") ;
    > }
    > } //end of code
    >
    > whi ch the compiler gives Yahoo! Games - play chess, backgammon, pool
and more --- Do you need true END-TO-END (e2e) Java Messaging (JMS)?
Softwired offers industry's ONLY complete 100% JMS messaging solutions for
your needs TODAY. Visit
http://adtracking.wrox.com/track.asp?x=p2p%2Fe%2Fjava%2Dsoftwired&url=www.so
ftwired-inc.com Our unique product range includes: iBus//Mobile (wireless
data), iBus//MessageBus (IP Multicast), iBus//MessageServer (store and
forward) and much more! --- 
http://p2p.wrox.com/manager.asp or 


Message #8 by "Rich" <rpcee@o...> on Fri, 26 Apr 2002 11:42:27
is this a copy/paste of your code?
ie, you don't have a double ; after the if on line 8 like so:

if (...)
   System.out.println("...");;
else
   System.out.println("...");

that would cause this problem 

  Return to Index