• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

CAn I use Page^5 as a class name? I can't use it in eclipse but I am able to run it in Command line

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Can some clarify !!!

I tried the follwoing simple program

public class Page^5{

public static void main(String[] args){
System.out.println("WELCOME");
}
}

I am able to run this program in Command. But I can't create a class Page^5 in eclipse.
Can someone explain me why?

I am using java 1.6

Thans in advance.





 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Achari Chintaluri wrote:I am able to run this program in Command.


Really? I don't believe that, because this program doesn't even compile.

The character ^ is not a valid character that you can use in identifiers in Java (class names, method names, variable names etc.). Paragraph 3.8 of the Java Language Specification explains what characters you can and cannot use in identifiers.
 
Achari Chintaluri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jesper,

Thanks for your reply. I am also surprised. But it is true.
Did you try this?

Attached the screen shots. But no other special charatcters is working except this.
Img1.JPG
[Thumbnail for Img1.JPG]
Img2.JPG
[Thumbnail for Img2.JPG]
Img3.JPG
[Thumbnail for Img3.JPG]
 
Achari Chintaluri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry img1 is wrong. i attached another one.....
Img4.JPG
[Thumbnail for Img4.JPG]
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See this. The caret character (^) is a CMD.EXE escape character and it is ignored in this case. You're actually executing Page5.class in both cases. Hint: there is no Page^5.class in your listing - Page^5.java was never successfully compiled.

Look at the compiler output. That would give you more authoritative answer.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Next time, please copy and paste text instead of posting screenshots.

See Copy To the Clipboard From the Windows Command Prompt if you don't know how to copy and paste text from the Windows command prompt window.
 
Achari Chintaluri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Martin,

Got it. Thank you very much for your help.
 
Martin Vashko
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
reply
    Bookmark Topic Watch Topic
  • New Topic