This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keyword

 
Muhammad usman shad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we make our own keywords in java???
If yes then how and if no then why???
 
Danish Sualeh
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Pie
Posts: 21114
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a "beginning" question. Moving thread.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic