Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-02-2008, 03:40 AM
Member
 
Join Date: Mar 2008
Posts: 24
Azndaddy is on a distinguished road
[SOLVED] Check command
Hi, how code is needed to check an input of command so that, when the command is entered wrong it would return null;

example: on this class
PHP Code:
public class Quit extends Commands
{
    public 
Quit(Editor editor)
    {
        
super("quit"editor);    
    }
    
    public 
void execute()
    {
        
System.out.println("Bye!");
        
System.exit(0);
    }

Help would be great

Thanks
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-02-2008, 06:45 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,402
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
If your command is a string, I think it is "Bye!", simply use a boolean variable, with comparing Strings. It the variable is true, do the process you want. If it is false do nothing.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-02-2008, 06:53 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Azndaddy, what you're referring to is basic programming logic, fundamentally in the if/then area of logic. This will be a common task throughout your programming career and in this case, because the code you provided is a little obscure, is a task only you will be able to complete.

Post more general code and we can assist. But basically, it goes something like this:
Code:
... if (command != desired) { // do something to imply wrong command } else { // do the thing you were meaning to do } ...
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-02-2008, 07:11 AM
Member
 
Join Date: Mar 2008
Posts: 24
Azndaddy is on a distinguished road
yeah i know its the basic, but it been too long since i touched java programming. i'll see what i can do.

thanks for the help
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CRC check program 1 error javakid9000 New To Java 1 03-19-2008 07:04 AM
Can someone check my code joz_12345 Java 2D 7 02-18-2008 04:58 AM
spell check kazitula Java Applets 2 12-20-2007 01:37 PM
check command method please dirtycash New To Java 1 12-06-2007 11:35 PM
Unable to execute command line command in java LordSM New To Java 1 08-08-2007 02:23 AM


All times are GMT +3. The time now is 04:37 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org