Noob Help: Uknown Error

Ok...so im writing this program and the issue starts at the last line of what ima post
import java.util.Scanner;
public class BasketballQuiz {
     public static void main (String[] args) {
          Scanner sc = new Scanner (System.in);
          int Strawberry = 2, Gist = 15, Jones = 23, Ibekwe = 25;
          System.out.print ("Type 1 to enter a number or 2 to enter a name: ");
          int i = sc.nextInt();
          if (i == 1) {
               System.out.print ("Enter player number: ");
               int n = sc.nextInt();
               if (n == 2) {
                    System.out.print ("Which player wears number " + n + " on his jersey? ");
                    int p = sc.nextInt();
                    if (p == Strawberry) {
I go to run the program and I get this error
Type 1 to enter a number or 2 to enter a name: 1
Enter player number: 2
Which player wears number 2 on his jersey? Strawberry
Exception in thread "main" java.util.InputMismatchException
     at java.util.Scanner.throwFor(Unknown Source)
     at java.util.Scanner.next(Unknown Source)
     at java.util.Scanner.nextInt(Unknown Source)
     at java.util.Scanner.nextInt(Unknown Source)
     at BasketballQuiz.main(BasketballQuiz.java:17)
Ive been tryin stuff for a while and nuthin works...can any1 help me out?

At the point where the code is expecting an integer, you're inputting "Strawberry". "Strawberry" is not an integer. Thus the exception is thrown.
You've declared a variable called "Strawberry", but that's a very different thing from the string "Strawberry" inputted by the user.
What you probably want to do is:
First, use a Scanner method that reads in a String, not an integer.
Then, in the code now, compare that String with the various names, as Strings. Like this:
String name = sc.next(); // it might be a different method from next(); read the docs for details
if (name.equals("Strawberry")) {

Similar Messages

  • TS3694 I'm trying to update my Iphone Software to the the new IOS 7 but it says there as an uknown error (6). Can someone please help me? Thanks

    I'm trying to update my Iphone Software to the the new IOS 7 but it says there as an uknown error (6). Can someone please help me? Thanks

    http://support.apple.com/kb/TS3694
    Check the section on
    Errors related to third-party security software

  • TS1368 Can not connect to iTunes after updating to 10.7 on window Vista 64bit. "Uknown error - 42408"

    Just updated to iTunes 10.7 on Windows Vista 64bit and now when I try to connect to the iTunes store and just get "Uknown error has occured-42408" Please help!!!!!!!

    Many thanks to the other hemisphere!
    SpeedBit Video Accelerator - I cannot uninstall it, so I have upgrade it. Store is accessible now!
    The only but is there are again some problems with upgrading from 10.6 to 10.7, but this is another story.
    Thanks again,
    Martin

  • An error occured while conecting to an airplay device uknown error -15000

    I have recieveesd this message while trying to stream music through air play from my PC to the apply TV.
    "an error occured while conecting to an airplay device uknown error -15000"
    Movies are streaming fine, but I get this message when I try to send music to the apple tv. I have enable music sharing in my preferences.  I updated my itunes today on 12/26/12.  Any help is appreciated.
    An additional note, I have an updated iphon 4s and airplay functions fine when sending music to the apple TV.  It only replies with this error when I am comcecting through itunes on my computer.

    Welcome to the Apple community.
    Have you tried restarting the Apple TV, the iPad/iPhone and your router.

  • Illustrator Uknown Error - Saving Vector Smart Object

    Hi,
    When I open a vector smart object from PS I get 'An Uknown Error Occured' and can't save the file. Has anyone else run into this? I'm not sure how to fix it. Thanks.

    Do you mean that you are double clicking on placed smart object and you get the error. Is the smart object originally from Illustrator and does Illustrator open open?
    Would help to know more detail about EXACTLY when your error happens and far you get. This way we can determine if you have a file association problem, memory problem, corrupt font/image problem.

  • TS3221 itunes could not connet to this iphone becuz an uknown error occured

    Hi dear,
    i have this problem ( itunes could not connet to this iphone becuz an uknown error occured )
    i need help please

    is ipone4s thank u

  • Help with error 16820

    help with error 16820 with trying to update acrobat

    Please refer to following links, might be helpful.
    http://answers.acrobatusers.com/While-updating-acrobat-error-code-showd-16820-solve-q7115. aspx
    http://answers.microsoft.com/en-us/windows/forum/windows_vista-windows_programs/acrobat-co m-will-not-update-getting-error-16820/7bbbef64-df3e-4fbd-b552-fc1c7a5983c3?msgId=dcf838d8- a198-4a3a-b034-94a07c2e8648
    If this doesn't work, we need more information here.

  • RoboHelp Server 7 Help System Errors

    Whenever I publish my RH 7 Help project to server, I check
    the RoboHelp Server Web Administrator for errors. I always get Help
    System Error "Requested file cannot be found" for a file called
    bsscfp.txt. To my knowledge, this is a control file generated
    during the publishing process. If this is the case why is an error
    being generated for a file I have no control over? Also, I find the
    Troubleshooting section of RoboHelp Server Web Administrator to be
    rather useless in correcting issues. Is there any reference
    documentation that explains some of the cryptic error messages that
    appear in the Server Web Administrator screen?

    Hi, ouque and welcome to the forum.
    Just to clarify your setup. When you say "Project pane" are
    you referring to the Configuration Manager on the server itself.
    Or, are you referring to something you are seeing from the RoboHelp
    authoring client app's Server Administration pane?
    If you have access to the actual server desktop and view the
    Configuration Manager, sometimes on a new installation, you can do
    a "refresh" and the project will show up.
    A few more questions:
    Have you tried accessing the website and does the project
    come up in the web browser?
    On what kind of web server did you install RHS7? Windows
    2003, etc.?
    Is Microsoft Indexing Services turned on?
    Apparently you were able to successfully publish your project
    to the server so there is "communication" between your desktop and
    the server I gather.
    A few more details and we'll try to help.
    Thanx,
    john

  • Search help: Internal Error.

    Hi,
    I am getting information message : 'Search help: Internal Error' after incorporating code in RETURN event. My aim was to populate the value from Hit list to Value with restriction field and then by removing some search select criteria, again display the hit list. It is coming back to the value with restriction field screen  also populating the fields properly, below 1 information message is coming 'Search help: Internal Error'. If I remove some field from selection and again press the go button, it is doing nothing and system is hanging. The details are given below.
    I have created one search help ZTMVGR1 having the following details:
    Search help type : Elementary.
    Selection Method : MVKE
    Search help exit:  ZF4_MATGRP_EXIT1.
    Display value with restrictions : A
    Field          Import           EXPORT   LPOS      SPOS   SDis     Data Element
    MATNR       X                   X              5             5                     MATNR               
    VKORG      X                   X              1              1                     VKORG
    VTWEG      X                   X              2              2                     VTWEG
    MVGR1      X                   X               3             3                      MVGR1
    KONDM      X                   X               4             4                      KONDM
    MAKTX      X                   X               6              0                     MAKTX
    In the search help exit ZF4_MATGRP_EXIT1 I have used three events:
    1) PRESEL : Purpose of using this was I was not able to see F4 help for few fields in value with restriction screen . I found out that in SHLP-INTERFACE-F4FIELD is equal to 'X', sometimes in search help if that field's value is 'X' , F4 help does not come even if check table exists for that field.
    2) DISP : Purpose, I want to fetch material description field in exit only. MAKTX does not exist in MVKE, so either I need to create a view containing all my fields, or populate the one which is not there in selection method in exit.
    3) Return : Purpose,  I want to put VKORG, VTWEG and MATNR ( MATNR has collective search help, based on material description , we can put material ) . The hit list we get contains VKORG, VTWEG, MATNR, KONDM, MVGR1 and MAKTX. When we double click on hitlist the value returns , I want to populate these entries in value with restriction field. So KONDM and MVGR1 field will be populated. Now I will remove the value of material-low  from selection screen and find out for VKORG, VTWEG and MVGR1/KONDM what materials are there. But after writing the code for event RETURN I am getting information message 'Search Help: Internal Error'.
    My code snippet is given below.
    <removed by moderator>
    Moderator message: please post only relevant code parts, your posts must contain less than 5000 characters to preserve formatting.
    Edited by: Thomas Zloch on May 13, 2011 1:35 PM

    HI,
    In search help exit you need to use the below mentioned function modules
    'F4UT_PARAMETER_ALLOCATE'          For allocating fields
    'F4UT_PARAMETER_VALUE_GET'       Get Value
    'F4UT_PARAMETER_RESULTS_PUT'     put Value
    In the same order.
    Thanks & regards,
    Bhargav.

  • Please Help - "page error" / a system error occurred

    I am very basic with Coldfusion Developed websites and pretty awesome on HTML and PHP. While working on a website I made an HTML change and added a line to a page. All works well on the test website/server but after uploading the changed page the page went offline/errored a day later.
    I have an error receipt and am hoping to resolve this issue with some insight from a good Coldfusion Developer or Programmer.
    PLEASE HELP, see error below.
    A system error occurred: http://www.mix.co.zm/mix_schools.cfm?
    Error - struct
    Detail    Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc. <br> Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.
    Message    Could not find the included template components/mix_documents2.cfm.
    MissingFileName    components/mix_documents2.cfm
    StackTrace    coldfusion.tagext.lang.IncludeTag$NoSuchIncludeTemplateException: Could not find the included template components/mix_documents2.cfm. at coldfusion.tagext.lang.IncludeTag.setTemplate(IncludeTag.java:349) at cfmix_schools2ecfm527774291.runPage(D:\hshome\mixnet\mix.co.zm\mix_schools.cfm:15) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:231) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:416) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:360) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:94) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.CfmServlet.service(CfmServlet.java:200) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at com.intergral.fusionreactor.filter.FusionReactorFilter.i(FusionReactorFilter.java:566) at com.intergral.fusionreactor.filter.FusionReactorFilter.c(FusionReactorFilter.java:258) at com.intergral.fusionreactor.filter.FusionReactorFilter.doFilter(FusionReactorFilter.java: 164) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42 ) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
    TagContext    Error - array
    1    Error - struct
    COLUMN    0
    ID    CFINCLUDE
    LINE    15
    RAW_TRACE    at cfmix_schools2ecfm527774291.runPage(D:\hshome\mixnet\mix.co.zm\mix_schools.cfm:15)
    TEMPLATE    D:\hshome\mixnet\mix.co.zm\mix_schools.cfm
    TYPE    CFML
    TagName    CFINCLUDE
    Type    MissingInclude

    With LR closed move the preferences file to the Trash as described at the below link. You will lose your Preferences settings, so you may want to record them if unsure what you have changed from the default settings.
    http://helpx.adobe.com/lightroom/kb/error-changing-modules-lightroom
    DO NOT RESTART LR!
    Next uninstall LR and then completely shutdown your system and turn the power OFF. Your catlog(s) will not be removed, so no worries.
    Restart your system and reinstall LR using the latest version download available (LR5.4, LR4.4).
    What version of LR and OS X are you using?

  • My macbook pro intel core duo 2 keeps restarting intermittenly. Help with error code.

    I have run a Hardware Test, and it gives the follwing error code. Can anyone tell me what this is? I recently had my logic board replaced within the last 3 months, so it shouldn't be a problem there.
    Thank you very much for any and all help.
    Error code:
    4SNS/I/40000000:TGOH-128.00

    Online references possible memory issue? Sensors?
    https://discussions.apple.com/thread/3140607?start=0&tstart=0
    Keep taking it back and they keep switching parts until the problem is gone.

  • Need help with error message 213:8

    Need help with error message 213:8, this error message prompted after re-installing CS5.5 on the same machine (W7 Pro)
    Thanks.

    Hi TKA_,
    Please try the solutions mentioned on following forum thread.
    http://support.muse.adobe.com/thread/1305941?start=0&tstart=0
    Let me know if it works?
    Regards,
    Sumit Singh

  • How to explicitely write PLSQL code for "Help - Display Error"? [SOLVED]

    I'm using menu DEFAULT&SMARTBAR and I'd like to write command in PLSQL code for "Help - Display Error" to display error. Has anyone any idea how to do this? I can not find syntaks in form help for this.
    Message was edited by:
    marussig

    Display_Error;

  • HELP PLEASE - ERROR ON PANSONIC P50VT20B AND Panso...

    HELP PLEASE - ERROR ON PANSONIC P50VT20B AND Panasonic HOME CINEMA SC-BTT775.
    the moment i login using the tv or blu-ray i cannot choose anything other than ' Back to homepage ' message which is displayed under my contactlist on tv... at times it says too many contacts... Kindly help... the camera is skyoe ty-cc10w for panasonic tv's and blu-ray...

    Same issue

  • Hello apple.help me network iphone 4 use ios7.12 error network.acoount icloud apple please help support errors no service network.thank you

    hello apple.help me network iphone 4 use ios7.12 error network.acoount icloud.apple please help support errors no service network.thank you
    <Personal Information Edited by Host>

    tran ngoc nhan,
    Viết bằng tiếng mẹ đẻ của bạn?
    Tôi đoán Việt Nam?
    Chúng tôi có thể dịch!
    Nói cho tất cả vấn đề của bạn!
    Cung cấp cho nhiều chi tiết!
    Nếu không Việt Nam, dịch này ở đây!
    https://translate.google.com/
    Write in your native language?
    I guess Vietnamese?
    We can translate!
    Tell all your problem!
    Give much detail!
    If not Vietnamese, translate this here!
    https://translate.google.com/
    CCC

Maybe you are looking for

  • Difference between MIGo and MIRO for GR IR clearing

    Hi all, I hav created one PO in foreign currency for 10 items. GR is happening for all 10 lines with rate say Rs 50. Now when i am doing MIRO with same rate i.e. Rs 50, 8 materials are getting posted correctly. But for 2 materials there is inventory

  • A script that captures the coordinates of the mouse clicks and saves them into a file

    Hello, I'm trying to create a cartoon taking a movie (I've chosen blade runner) as base. I've got the real movie and I've exported all the pictures using VirtualDUB. Now I have a lot of images to modify. I would like to modify the actors faces with t

  • Firmware upgrade interference?

    Is it possible that a firmware upgrade file can interfear with a printer causing it not to print?   Can it also interfear with the computer getting those automatic updates for windows xp?  This computer is wired to the router.  I was told you can del

  • Fm radio problem and speakers zen nano plus..

    . Why does my zen nano plus automatically turns of when i use the fm radio even if it has full battery? 2. Why does my zen nano plus automatically turns of when i connect pc speakers even if it has full battery? I NEED HELP!!!!!!!!!!!!!

  • Bug on MobileMe disk browser

    When I open MobileMe page on safari, in the section iDisk, if I have a few subfolders, a in the last folder I have a lot of files, the last file that shows correctly like this: There is anyway to change this?? Thanks.