Not urgent, just simple question.

Okay, just a curiosity, why will not the Goto login(); and similar sections of the code not work? Am I using a non-existant command? VB6 has ruined me..
import cs1.Keyboard;
import java.io.*;
public class Game
     public static void main (String[] args) throws IOException
          System.out.println("*************************************************");
          System.out.println("********************Day's End********************");
          System.out.println("*************************************************");
          System.out.println();
          System.out.println("(L)og in");
          System.out.println("(C)reate character");
          String goForIt = Keyboard.readString();
          if (goForIt.equalsIgnoreCase("c")==true)
          CharCreate.newCharMaker();
          else
          Goto login();
     public void login();
          System.out.println();
          System.out.print("Character's name: ");
          String lName = Keyboard.readString();
          System.out.print("Account password: ");
          String lPassword = Keyboard.readString();
          Goto openChar(lName,lPassword);
     public void openChar(String name, String password);
     //     BufferedReader fileIn = new BufferedReader(FileReader(name+".txt"));
}

New questions... My problem is that now, it appears that it never accepts a password from the txt file, or if it does, it doesn't recognize the password I type in as matching. Any ideas why? It's a simple txt file, no encryption... heh, not even an attempted encryption.
I am getting no code errors, just that it doesn't work the way it should.
import java.io.*;
import cs1.Keyboard;
public class Menu
     public Menu() throws IOException
                                           //Menu
          System.out.println("*************************************************");
          System.out.println("********************Day's End********************");
          System.out.println("*************************************************");
          System.out.println();
          System.out.println("(L)og in");
          System.out.println("(C)reate character");
          String goForIt = Keyboard.readString();
                                           //Insures legal response
          while (goForIt.equalsIgnoreCase("c")!=true &&
                  goForIt.equalsIgnoreCase("l")!=true)
               System.out.println("Invalid choice");
               System.out.println();
               System.out.println("*************************************************");
               System.out.println("********************Day's End********************");
               System.out.println("*************************************************");
               System.out.println();
               System.out.println("(L)og in");
               System.out.println("(C)reate character");
               goForIt = Keyboard.readString();
          if (goForIt.equalsIgnoreCase("c")==true)
          CharCreate.newCharMaker();
          else if (goForIt.equalsIgnoreCase("l")==true)
          login();
                                           //Gets login info
     public static void login() throws IOException
          System.out.println();
          System.out.print("Character's name: ");
          String lName = Keyboard.readString();
          System.out.print("Account password: ");
          String lPassword = Keyboard.readString();
          openChar(lName,lPassword);
                                           //Opens the character file and tests password.  If the file does not exist, it sends the user back to the main menu.
     public static void openChar(String name, String password) throws IOException
          String str;
          try
               BufferedReader fileIn = new BufferedReader(new FileReader(name+".txt"));
          while ((str=fileIn.readLine()) != null)
               str=fileIn.readLine();
               str=fileIn.readLine();
          if (str.equals(password)!=true)
               System.out.println("Incorrect password for the declared account");
               fileIn.close();
               Menu asdfjkl = new Menu();
          else
          System.out.println("Congratulations, you have logged in with the character " + name);
          fileIn.close();
          catch (Exception e)
               System.out.println("Invalid character, returning to Main Menu.");
               Menu asdfjkl = new Menu();
}

Similar Messages

  • Just simple question about java HTTP session mechanism...

    I have one simple question regarding the java HTTP Session Mechanism.
    1) Is there another alternative for the HTTP Session ? If have, what the alternative?
    2) I have been acknowledge that HTTP session is same as cookie system and others say have many different, where is the different..
    thanks

    1) You can always do your own session handling. But why bother when there is one there for you?
    2) The issue with sessions is how to identify the user from the request. Each session gets given a session id. The user has to send that session id with every request they make.
    The standard way is to use a session cookie, which only lasts as long as the browser session. The cookie with the JSESSIONID is sent with every request, thus the server can identify which session a user is in from their cookie.
    Of course you cannot assume that the browser will support cookies, so you need to encode all URLs with the method response.encodeURL(). That method puts the session id into the URL if the browser does not support cookies, or they have them switched off.

  • URGENT! Simple Question about JsfUtils.addErrorMessage

    Hello All,
    Below is a very simple code which checks that if
    1. ArrayList which contains error messages is not empty, convert each message to String and display in the JsfUtils.addErrorMessage.
    ArrayList errorMessages = new ArrayList();
    //DO VALIDATIONS TO GET ERROR MESSAGES IN ARRAYLIST
    if(!errorMessages.isEmpty()) {
    int EMLength = errorMessages.size();
    for (int i = 0; i < EMLength; i++)
    String msg = errorMessages.get(i).toString();
    JsfUtils.addErrorMessage("",
    FacesMessage.SEVERITY_ERROR, msg, msg);
    return NR_THIS_PAGE;
    I get message like:
    - [Please enter a value for Name field!]
    How can I get rid of *[]* in the error message ? If one of the values was empty, I get an empty *[]* - how can I get rid of it?
    I think the reason for [] is that I am using ArrayList. But the number of messages may vary from none to 10 and that is why I need something that grows dynamically.
    Thanks a ton for your responses,
    Edited by: user12054715 on Apr 23, 2010 12:35 PM

    Hi Pino,
    Thanks for the response! I am getting compiler error:
    Error(2029,40): incompatible types; found: class java.lang.Object, required: class java.lang.String
    at the following line in your code:
    *for(String msg: errorMessages){*                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Not urgent just wondering

    At my job I have seen programmers doing something I had never seen before. I don't think it is a good idea, what do you think?
    One foo.java file contains:
    class foo {
    class boo{
    These are not inner classes and I think that the boo class should be put in a boo.java file. To me it seems easier to read and work with but I don't know if there is any problem with doing as shown above. Any input?

    It is legal. It was done more before Java 1.1; back in the Java 1.0 days there wasn't any such thing as an inner class. Even Sun's own tutorial programs would tend to put other classes in the same file. You are creating something with package scope; it can be accessed by other classes in the same package, but not by anything outside of the package.
    As a matter of style it is confusing if any other class in the package would want to use that class. A developer would see a reference to the class and they'd be hunting around for the file that contained it. I think your reaction is understandable; if the class is shared then it should be in its own file. If it isn't shared, then it doesn't matter but I think it would be safer to make it an inner class. If two different developers were working in the same package, and both tried to create a class "boo", they'd have a problem whose cause wouldn't be known without trolling through potentially all the source in the rest of the package.

  • Re: add-ons. Just a simple question I couldn't find an answer to. Is the term "uninstall" equivalent to "remove the software from the computer"?

    I downloaded a You Tube downloader, and expected an icon to come up when You Tube was playing, according to a friend's advice.
    Since this didn't happen I assumed the download didn't work, or was an old version that doesn't work anymore. I wanted to just get rid of it and try another downloader.
    I went to Tools--> Add-ons--> and clicked on the downloaded software and saw the 2 options [Disable] and [Uninstall]. The terminology is unclear, as I've always thought once software resides on your computer you can install it or uninstall it without erasing it from the computer.
    A simple question that seems obvious except to someone who wants to be very precise and sure. Basically "does [Uninstall] mean erase from the computer"?
    Thanks

    With Firefox extensions (Tools > Add-ons > Extensions) you have two possibilities. You can disable an extension if you do not want to use it now, but want to keep it. Or you can uninstall an extension and remove it from the computer. Note that uninstalling an extension still leaves prefs in about:config (prefs.js) and possibly files in the profile folder that will be reused in case you decide to reinstall an extension at a later time.
    See also http://kb.mozillazine.org/Uninstalling_add-ons

  • Javac : command not found ?? A simple question.

    Hello.
    I need to somehow tell linux where to find javac so that I don't need
    to type in /usr/local/jdk1.4/javac HelloWorldApp.java every time I need
    to run javac. I have seen how to do this in windows but I don't know how to do it in Linux
    I know it's a simple question, I'm just new to Linux.
    Your help is appreciated.

    The answer depends on the shell you use.
    The default on linux is bash, so do this: In your home directory there is a file with the name .bashrc. Commands in that file are performed every time you start the shell.
    In that file, add the command "export PATH=/usr/local/jdk1.4/bin:$PATH". Then "source .bashrc" so that the change takes effect. You can verify that the directory has been added with "echo $PATH".
    If you want to set the path for all users and not just yourself, make the change in the system startup files. This depends on your distro; the right file might be /etc/profile or /etc/profile.local or /etc/bashrc.

  • Why does this site have online chat when you can never actually chat - always "not available"?  I was trying to get a simple question answered without calling and being on hold for 10 minutes?

    Why does this site have online chat when you can never actually chat - always "not available"?  I was trying to get a simple question answered without calling and being on hold for 10 minutes?

        Hello flabucki,
    Help is just a post away for you my friend! I can help with your questions right here. May I ask what question do you have? Both myself and the community would love to assist in any way that we can.
    Thank you…
    ArnettH_VZW
    Follow us on Twitter @VZWSupport

  • Really?  All Adobe has for customer service is a forum?  I have a simple question.  Can't just contact someone?  Are you that cheap?

    really?  All Adobe has for customer service is a forum?  I have a simple question.  Can't just contact someone?  Are you that cheap?

    Not to be critical, but in the time you have waited to find out how to contact Adobe you probably would have had your question answered by someone here on the forum. Many times people have been given bad information when they have found a way to contact Adobe. Much of the so-called technical support has been outsourced overseas. And the people manning the phones have no experience with Adobe products. So you can complain some more. Or, you can ask your question. It's your choice.

  • Simple question..or not!

    Hi gurus.
    I have a simple question to do!!
    In my ETL map I need to create the follow rule.
    ERP Table to DW table:
    - if ERP table primary key = DW table primary Key then execute the UPDATE command in DW --> THIS IS OK!
    - if ERP table primary key <> DW table primary Key then execute the INSERT command in DW and insert the value 'ACTIVE' in status column. --> THIS IS OK!
    DW table to ERP table:
    - if DW table primary key <> ERP table primary key then execute the UPDATE command in DW and insert the value 'INACTIVE' in status column.
    - if DW table primary key = ERP table primary key then ignore.
    Somebody knows how can I do this?
    Thanks in advanced.
    Bruno

    In my experience MINUS works just fine in this type of scenario where you are comparing two key columns from two tables. You should make sure that both columns are indexed, and that the mapping is running "set based". In this scenario the CBO will do two index sorts and a minus operation to compare the sorted indexes.
    I agree that other methods, like using an outer join and filter, or a "not exists" subquery probably are faster in many cases but if performance is not a real issue, I prefer using minus due to (what I perceive as) better readability of the mapping
    Roald

  • Just a simple question from a noob

    Hey guys
    im just working on my website, im not doing anything complicated just simple stuff.
    I just want to add a @facefont and change /edit the rules to just let me change the font. I wish it were as easy as just changing it with the property inspector but ive come to figure out that it doesnt work that way. Every time ive asked this question ive been referred to websites that have a 4 page guide on fonts,but this rarely helps me. im just looking a direct on how to do this. BTW im working with a preloaded template from dreamtemplate so everything is already formatted.
    problems: whenever i try to change the font and save it nothing saves but the font size, i want to add @facefont and change the font
    thanks in advanced

    Using Custom Web fonts is a bit more complex than you realize. 
    http://alt-web.com/Articles/Custom-Web-Fonts.shtml
    To make things simple, I recommend using one of the Free Edge Web Fonts.  Simply copy & paste code into the <head> tags of your HTML page. 
    EXAMPLE:
    <!--Edge Font-->
    <script src="http://use.edgefonts.net/pt-sans-narrow:n4,n7:all;league-gothic:n4:all.js"></script>
    Then define the font in your CSS code:
    h2 {font-family:pt-sans-narrow, "Arial Narrow", sans-serif;}
    h3 {
    font-family: league-gothic, Impact, Haettenschweiler, "Franklin Gothic Bold", "Arial Black", sans-serif;
    HTML code:
    <h2>This is Heading 2 - pt-sans-narrow</h2>
    <h3>This is Heading 3 - league-gothic</h3>
    Nancy O.

  • Just a simple question, before deciding to switch

    Uhhh, yeah, I've been considering an Apple for a while, and I've pretty much made up my mind, but I had a simple question. I've been with Windows ever since I began with computers, and as long as I can remember, there's been Paint. Does Mac OS X come with anything like Paint?

    Uhhh, yeah, I've been considering an Apple for a
    while, and I've pretty much made up my mind, but I
    had a simple question. I've been with Windows ever
    since I began with computers, and as long as I can
    remember, there's been Paint. Does Mac OS X come
    with anything like Paint?
    Prior to the new release of MacBooks and Intel iMacs, the Mac was accompanied by Appleworks which has a fine paint program among many other productivity suite applications. You would find it very comfortable to use if you were used to the Windows Paint program because they are much alike.
    Unfortuantely Apple doesn't include it on the new MacBooks or on the iMacs today but that is not to say you can't get ahold of a copy and install it on your new MacBook. Installing programs on a Mac is *sooooo much easier* to do then on a Windows machine and *sooo much easier* to remove (you just drag them to the trash can).
    When you get your new Mac you can buy a copy of Appleworks from Apple ( take a look: http://www.apple.com/appleworks/ ).
    Hope this helps!
    Tim...
    20" Intel iMac 2GRam/500G-HD, 13" BlackBook 2GRam/120G-HD, Black Vid iPod 60Gig   Mac OS X (10.4.6)  

  • This might be a simple question.   On those sites that do not differentiate between models when on the internet I.e. Facebook when after your comment and you cannot hit "enter" on an iPad for examp. And speed is slow to connect.  What is = to post?

    This might be a simple question. On those sites that do not differentiate between CRT, laptop, tablet etc. such as an iPad Mini and using the Facebook site fir example when going to post a comment and you do not have a enter button on the IPad and the speed is slow how do you get your comments to post if we do not have a enter button? 
    <Email Edited By Host>

    I don't have facebook so I cannot answer but for your personal security, I have asked the hosts to remove your e-mail address.   It is very unwise to publish this.

  • A very simple question..Very Urgent

    HI,
    I have a very simple question.I am able to set up the client authentication as well as server authentication. Now do i need to authenticate (both server as well as client auth.) for every request i send to the server on https...i think it should be like that it should authenticate only for the first time and for the next upcoming requests in same session should not require any server or client authentication.. i think as it happens in browsers..
    what is the fact actually??..can somebody put some light...right now in my case it is authenticating for every requests..
    This is what i have done..
    /****constructor part********/
    // and tm are arrays of keymanagers and trustmanagers for client keystore and truststore
    sslContext.init(km, tm, null);
    HttpsURLConnection.setDefaultSSLSocketFactory(ssf);
    HttpsURLConnection.setDefaultHostnameVerifier(new MYHostNameVerifier());
    /****Method to send the request and response*********/
    urlConn = (HttpsURLConnection)url.openConnection();
    urlConn.setDoInput(true);
    urlConn.setDoOutput(true);
    OutputStream os = urlConn.getOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(os);
    oos.writeObject(someobject);
    oos.flush();
    InputStream is1 = urlConn.getInputStream();
    ObjectInputStream ois = new ObjectInputStream(is1);
    SomeObject retObj = null;
    retObj = (SomeObject)ois.readObject();
    ois.close();
    System.out.println("Get String>>>>> "+retObj.getString());
    I am creating the object of this class..and calling the method again and again for sending requests and response..so i think handshake everytime i call the method...what i want is that handshake should happen for the first time and for the next requests no handshake or certificates should be checked or processed..
    is it possible ..how..what i need to do for that..
    please help me in this..
    Akhil Nagpal

    Hi,
    how could I achieve SSL Session Resumption using HttpsURLConnection.
    Thanks.

  • Probably incredibly simple question, so sorry. I have just changed e-mail after many many years and I want to e-mail everyone in my mac mail client with the new e-mail address at the same time.

    Probably incredibly simple question, so sorry. I have just changed e-mail after many many years and I want to e-mail everyone in my mac mail client with the new e-mail address at the same time.

    If you are using Address Book, open it, create a new Group, select all you contacts by click the top one while holding down the shift key and then select the last one. Drag the contacts to the group, then send an e-mail to the group.

  • What do I do if wen I go to download an app it comes up with three security questions .wen I press on the third question it does not respond just turned blue n stays blue n won't let me go any further therefor not lettin me download any apps

    What do I do if wen I go to download an app it comes up with three security questions .wen I press on the third question it does not respond just turned blue n stays blue n won't let me go any further therefor not lettin me download any apps.   Thanks

    I have decided to dedicate this thread to the wonderful errors of Lion OSX. Each time I find a huge problem with Lion I will make note of it here.
    Today I discovered a new treasure of doggie poop in Lion. No Save As......
    I repeat. No Save As. In text editor I couldn't save the file with a new extension. I finally accomplished this oh so majorly difficult task (because we all know how difficult it should be to save a file with a new extension) by pressing duplicate and then saving a copy of the file with a new extension. Yet then I had to delete the first copy and send it to trash. And of course then I have to secure empty trash because if I have to do this the rest of my mac's life I will be taking up a quarter of percentage of space with duplicate files. So this is the real reason they got rid of Save As: so that it would garble up some extra GB on the ole hard disk.
    So about 20 minutes of my time were wasted while doing my homework and studying for an exam because I had to look up "how to save a file with a new extension in  mac Lion" and then wasted time sitting here and ranting on this forum until someone over at Apple wakes up from their OSX-coma.
    are you freaking kidding me Apple? I mean REALLY?!!!! who the heck designed this?!!! I want to know. I want his or her name and I want to sit down with them and have a long chat. and then I'd probably splash cold water on their face to wake them up.
    I am starting to believe that Apple is Satan.

Maybe you are looking for

  • Mac-PC Video Chat Stalls

    Just finished a great online "visit" with my grandkids in another state. The only problem was that their feed kept stalling after a couple of minutes of connection. We simply quit and re-connected and it would be good for a few more minutes. Is there

  • Close PO

    Hi experts, I want to close a PO for which a partial GR been done,now the purchasing don't need the remaining qty and want to close the PO so that no body can amend and order using that PO in future.... In that case where and how should i Configure t

  • How to Maintain Translation of texts of Exception Class

    Hi Experts, I have an exception class ZCX_CHECK . I have maintained a text in the text tab of the exception class like No components  Exists in  Package  &PACKAGE_NAME& PACKAGE_NAME is the Attribute . How do I maintain Translation of the TEXT. When I

  • Movement Type 351 against scheduling agreement for future dates

    Dear Gurus, For stock transfer orders(Inter Plant Transfers), if the schedules in receiving plants are available only in future(say after 15 days), the sending plant is able to make 351 against such scheduling agreements today itself. Is there any wa

  • Calling external URL with POST data

    Hi: In my action bean I have to call and external URL (outside my domain), and along with this URL 'POST' data. I have tried the following code: try { FacesContext lclFC = FacesContext.getCurrentInstance().getFacesContext(); lclFC.getExternalContext(