Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Keyword" Watch "Keyword" New topic
Author

Keyword

Muhammad usman shad
Ranch Hand

Joined: Jan 06, 2010
Posts: 30
Can we make our own keywords in java???
If yes then how and if no then why???
Danish Sualeh
Greenhorn

Joined: Oct 06, 2005
Posts: 11
Theoretically you could , but you'd have to modify the java compiler and jvm runtime engine.

That being said, the Java Community Process (JCP) has been the mechanism for developing standard technical specifications for Java technology.


Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18538
    
  40


Well, it depends on how you define "keywords". If your definition is how it is defined in the specification -- meaning reserved words to the Java language, and can't be used as identifiers in your program -- then no, you can't define new keywords.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You could also use a tool like the Java Syntactic Extender, but it's a *quite* old project (I first used it back in, say, 2003? 2004?) and may not support recent Java source code. It was, however, quite interesting, and (rightfully so) a source of endless consternation for my boss at the time.

So basically the answer is no, because Java is not a language that lends itself to doing such things.

Note that some DSL techniques can sorta-kinda make it look like you're adding keywords, but the syntactic verbosity of Java generally eliminates any usefulness of such trickery.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38033
    
  22
Not a "beginning" question. Moving thread.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keyword
 
Similar Threads
WA #1.....word association
Key Words
Is "null" a keyword in Java?
Whats the difference between keywords and reserved words
Tips to create this method