Trouble from the beginning

Hello all,
Just starting this program and allready have compile errors that I don't understand if you could enlighten me as to why i am getting these that would be highly obliged.
Thanks again in advance
Here are the errors:
A:\Chapter04\MyType.java:14: <identifier> expected
     public class static void main(String[] args)
^
A:\Chapter04\MyType.java:34: '{' expected
^
A:\Chapter04\MyType.java:35: '}' expected
^
3 errors
Tool completed with exit code 1
And my code so far
import java.io.*;
import javax.swing.JOptionPane;
public class MyType
     public class static void main(String[] args)
          //Declare variables
          String strChoice, strTryString, strTryInt, strTryDouble;
          int choice, tryInt;
          double tryDouble;
          boolean done = false;
          String answer = JOptionPane.showInputDialog(null, "What's My Type\n\n1) String\n2) Integer\n3) double\4) Quit the program");
          if (answer == null) finish();
          choice = Integer.parseInt(answer);
          return choice;
     // The finish method ends the program.
     public static void finish()
          System.exit(0);

Please read this tutorial about class creation. Your errors are basic and you apparently don't understand what you're doing, so just correcting them for you does not seem to be a solution of value.
http://java.sun.com/docs/books/tutorial/java/javaOO/classes.html
Two hints - the errors relate to a bad method statement, and look at brackets.

Similar Messages

  • My macbook pro was defective from the beginning. what to do?

    I bought my macbook pro about 4 yrs ago in my college year, and right after I found out there was some weird noise being made while the laptop was running.
    And compared to my school mates' macbook, mine got easily heated up and had a loud noise while running.
    So I took it to my school tech department and they said since its warranty is effective, why don't I go to apples, and so I did.
    At first, at the genius bar, a technician said it will cost me 400 and i was struck with shock ..
    fortunately, the technician found out that the laptop was defectively manufactured from the factory from the beginning and I was free of the fixing charge.
    However, my macbook pro's got a new problem. The screen goes black while running. I can hear the computer running but the screen is total pitch black.
    I went to apple store again to the genius bar to ask for the fixing fee.- It was 300 bucks for fixing it and they said there was a problem with
    the computer's logic board whatever. I bought the laptop for 1200$ and they are asking me for 1/4 of the price the laptop.
    The genius bar asked me if I ever dropped the laptop or left it somewhere near water whatever. I HAVE NEVER DONE THAT and the laptop was
    sitting on my loveseat in my room and when I came back from work and turned it on to get on internet...it didn't turn on.
    What am I supposed to do?
    I am so upset bc I have a paper to turn in for the beginning fo the next month, but since I can't afford to fix the computer, I am totally at a loss.
    I bought the laptop at Bestbuy when there was the event going on, which if you buy a mac, it comes with an ipod 2nd gen.
    When I bought it, there was a lil scratch like thin on top of the cover of the laptop, but I just thought like
    it will get a scratch while using it anyway and i just let it go and I bought a cute plastic cover for that laptop.
    If I knew that that was something like a defective product, I wouldn't have bought it or exchanged it with a new one.
    Where do I complain about this? whom do I talk to? why does apple distribute defective products to customers and make us to pay so much money to fix it after the warranty is done?
    Apple should be responsible for this.
    For someone like me, who's a poor student who can't get anymoney from anywhere (I am being supported by my church), what am I supposed to do?
    I want a responsible answer from Apple.
    or if anyone knows how I should deal with this, please answer me.
    I am really at a loss and desperate due to my financial situation. Thank you.

    I had a very similar issue.  I am not sure which machine you have.  I purchased 2 MacBook Pro's mid 2010 2.66ghz.  One is dead the other failing.  I am with you, you shouldn't have to purchase an extended warranty on a premium product.  I have seen a lot of posts on this subject.  Seattle Rex took Apple to court last year over the same issue and won in small claims court.
    http://www.seattlerex.com/seattle-rex-vs-apple-the-verdict-is-in/
    I am sure a class action lawsuit is not far off.  It is fraudulent to sell a product that is known to be defective.  I purchased my laptops from Apple.com in 2011 after the testing program had already started.  From what I can deduce the logicboard and Lion do not get along.  CNET has several articles on this issue.  Here is the notice from Apple that is very hard to find.
    http://support.apple.com/kb/TS4088
    Here is an article from CNET
    http://reviews.cnet.com/8301-13727_7-57586703-263/graphics-related-crashes-resur face-for-mid-2010-macbook-pro-systems/
    Maverick is supposed to help but for me that is a day late and $4000 dollars short. 
    If you do bring your laptop in, print out the notice.  The guys and gals at the Genius Bar will not know about this issue.  They tried to sell me a new MLB too as well as trying to wipe my hard drive.  Good luck, I hope this helps.

  • I bought a movie three days ago.  It begins to download from the cloud, then my iPad goes to sleep and when I open it again, it starts downloading from the BEGINNING.  How do I get the WHOLE MOVIE to download?  I have re-booted but that didn't help.

    I can't seem to figure out how to download a movie.  It begins to download (and yes, I've checked my download speed and my bandwidth and both should, in theory, be adequate to download a movie!) but then the iPad will go to sleep and when I get back to it, it shows that I have bought the movie but nothing is downloaded.  And when I try to download the next time, nothing is saved and it starts again from the beginning of the download.
    I sat down by my iPad while I was working and every few minutes I would swipe to turn it on and it got over half of the movie downloaded.  But then I had to go to leave and now it shows nothing is downloaded.
    I can see having it take a few hours to download IF one was able to just start the download and walk away and come back later to watch the movie.  But to have to repeatedly begin from the start of the download is incredibly frustrating.  I would want my money refunded to my iTunes account at this point, if I was able to do that.  It's just not worth the hassle.
    Suggestions?  How does one download a movie from iTunes?  It should not have to be this hard!!

    See if you can redownload it.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    If you can then delete from your iPod if you can and redownload.
    If you can't delete from iPod, go to to iTunes>Store>Check for Available Downloads on your computer ,  amd dpwnload and sync

  • How to remove characters/lines from the beginning of an InputStream

    Hi,
    I have a program which receives several InputStreams. From each of these streams I have to remove 2 lines from the beginning. After the lines are removed, all the streams are combined to one with SequenceInputStream and read in one chunk. Is there an easy/simple way of doing this?
    One option I thought would be to read the char by char until 2 end of line chars have been detected and then read the rest of the data to a buffer. And the create a ByteArrayInputStream out of this buffer. Problem with this approach is, that the amount of data can be large, so putting all the data in to memory might cause problems.
    Another option is to use BufferredInputStream and use the readline() method twice to get rid of the lines that are not needed. After this I would write the data to some output stream, which is then converted back to input stream. Propably would work, but sound too much of work for a simple thing like this. There has to be better way.
    To make it simple, what I need is a method that looks like the following, or something similar
    *  Removes n number of lines from the beginning of a InputStream.
    *  @param is InputStream where the lines are removed
    *  @param numberOfLines int value to indicate how many lines whould be removed
    *  @return InputStream where lines have been removed.
    public InputStream removeLines(InputStream is, numberOfLines);Thanks.

    Here's the code, feel free to use it. Comments are also welcome.
    public InputStream removeLinesFromTheBeginning(InputStream is, int numberOfLines) throws IOException
              char c = 'c';
              int i = 0;
              for(int n = 0 ; n < numberOfLines ; n++)
                   do
                        c = (char)is.read();
                        System.out.print(c);
                        if(c == (char)-1)     // end of stream reached before any newline characters were found.
                             return null;
                        i++;
                   while(c != '\n');
                   System.out.println();
                   System.out.println("Characters removed:" + i);
                   System.out.println("n: " + n);
                   i = 0;
              return is;
         }Edited by: dave_spaghetti on Jun 16, 2009 5:42 AM
    Fixed a bug.

  • How can i restore my new macbook pro. Lion is installed from the beginning, but I have no cd. What am I suposed to do?

    How can i restore my new macbook pro. Lion is installed from the beginning, but I have no cd. What am I suposed to do?

    Boot your computer while pressing Command-R. You can reinstall Lion from here. Covered here:
    http://support.apple.com/kb/HT4718

  • How to delete the saved score in a game downloaded from app store for my macbook and restart the game from the beginning ? please help

    HOW to delete the saved score in a game downloaded from the app store to restart the game from the begining with fresh scores.
    i am unable to do so. please help

    In system preferences, create a new account again, using the short name of the "deleted" account. You may be prompted to re-use the old home folder. Log out and log in to test it worked. Then log in as your new admin, and do the delete process again. Don't choose to securely delete this time - just a regular delete.
    When you have time to spare, go to Disk Utility, and use the Erase tab to securely erase free space on the drive. This will accomplish the same thing that your originally tried to do. Use the fastest method - anything more secure is a waste of time. You may need to run it overnight - it can take several hours.
    Matt

  • How can I "clear" my old IPad? I'll sell it and must restart it from the begining as new, create new Apple ID,etc?

    How can I "clear" my old IPad ? I'll sell it and must restart it from the begining as a new one. To leve it as when I had purchased it.

    Settings>General>Reset>Erase All Content and Settings

  • I have used firefox for 3 or 4 years, today it would not open. I had to reinstall and start over from the beginning. I lost a lot of bookmarks and preferences.

    Adobe installed an update, which restarted my desktop pc. After restarting I was unable to open Firefox browser. So, I clicked on Firefox, and then run as... first I tried running as... and chose my name. Firefox browser still would not open. Then I chose administrator which opened Firefox browser, but, as a new Firefox installation. It did contain add-ons, but not book marks, history, downloads or preferences. Now i have started over from the beginning. Is there any way I can restore lost bookmarks and preferences? Do you think system restore would help?

    Are there still JSON backups in the bookmarkbackups folder?
    *http://kb.mozillazine.org/Lost_bookmarks
    You can use this button to go to the Firefox profile folder:
    *Help > Troubleshooting Information > Profile Directory: Show Folder

  • When i play back an mp3 dj mix i,ve burn,t to cd in my car when i turn the engine of and then restart the car the cd starts back from the beginning how do i solve this problem so that when i turn the engine on end off the cd plays from the same place

    when i play back an mp3 dj mix i,ve burn,t to cd in my car when i turn the engine of and then restart the car the cd starts back from the beginning how do i solve this problem so that when i turn the engine on end off the cd plays from the same place it did before i turned the engine off

    It could be that the CD player will only playback "Redbook" CD's from the previous position.
    And starts mp3 type CD's from the beginnig.
    However.. it's not Logic related.
    pancenter-

  • Because you this loading firefox.exe like process from the beginning of the computer with a load from 38 to 42000 kb or like I can solve this problem

    because you this loading firefox.exe like process from the beginning of the computer with a load from 38 to 42000 kb or like I can solve this problem, atualmente when lighting the computer among the processes that are loaded when beginning the computer is a process of name firefox.exe with a load of between 30 and 50000 kb but I don't find to the registered firefox inside the programs to crgar from the beginning when entering for msconfig.exe my operating system is so far windows xp up-to-date sp3 and my firefox is 7.0.1 version in Spanish that is my native language.

    That seems very suspicious. Two suggestions.
    First, try Firefox's Safe Mode. This will let you work around problems with add-ons and perhaps help you identify things to remove so that Firefox goes back to normal.
    I recommend making a backup of your Firefox settings before starting in Safe Mode. To back up Firefox, see [https://support.mozilla.com/en-US/kb/Backing+up+your+information Backing up your information].
    Next, try starting Firefox in Firefox
    [http://support.mozilla.com/kb/Safe+Mode Safe Mode]. Be careful not to "reset" anything permanently if you didn't back up.
    Does that work? If so, you may need to disable your add-ons and just bring the most essential ones back to life until you discover the problem one.
    Second thought: malware. You could supplement your usual security scans with these:
    Malwarebytes Anti-malware : http://www.malwarebytes.org/mbam.php
    SUPERAntiSpyware : http://www.superantispyware.com/
    HouseCall : http://housecall.trendmicro.com/
    Hope this helps.

  • Why do I get the error saying my session has timed out and to start the operation again from the beginning when trying to instal lion

    I've purchased Lion from the app store and successfully installed it on three computers...however, now I'm receiving an error saying my session has timed out and to start the operation from the beginning???  Help..Thanks

    This is asked and answered mnay times every day.  The forum search abr is on the right side of this page.
    Disable your firewall/security software.

  • I have an old project with AVCHD clips and I want to import the clips again with surround sound. How can I relink the project clips to the re-imported ones without doing the project from the begining?

    I have an old project with AVCHD clips and I want to import the clips again with surround sound. How can I relink the project clips to the re-imported ones without doing the project from the begining?
    I have a sony handicam and I imported the clips to iMovie and they lost quality and converted the audio to stereo. I want to import the project to final cut X and import the AVCHD in 1080p and surround sound and export the movie in bluray. Can I relink the clips without editing everything again?
    thanks!

    Only photos taken with the iPad, copied onto it via the camera connection kit, or saved from emails/websites etc can be deleted directly on the iPad - either via the trashcan icon in the top right corner if viewing the photo in full screen, or via the icon of the box with the arrow coming out of it in thumbnail view.
    Photos that were synced from a computer are deleted by moving/removing/de-selecting them from where they were synced from and then re-syncing. If you want to remove them all then normally you could just sync an empty folder (in terms of photos) to the iPad, but as you don't want to sync at the moment you can't do that.
    You can reset the iPad back to factory settings and start from scratch with it : Settings > General > Reset > Erase All Content And Settings

  • I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. Any solutions?

    I have tried to download a movie via iTunes. Every time the download nears the end, it stops and restarts from the beginning. This has happened 5 times. How can I clear the download or solve this?

    If it is a HD movie, it may not be enough. The iPad also need working space.
    Try download to iTune (computer) and "Move" to iPad.

  • Playbook requires me to pay for support when it did not work from the beginning and they could not fix.

    lack of email app- makes this may purchase virtually useless. because
    cant bridge with my bb 9700. maybe twice after deleting from both, and rebridging, i got connections. i cant spend an hour bridging every time. since may this is unfixable. the support people cant fix it after dozens of hours. got lots.of emails from them though. asking if i was resolved. when i answered no, they asked me to do it all again. they have no fix for this.
    can type documents, but cant email them to anybody. same with excel. no way to attach documents when the bridge doesnt work.
    i am a ceo,and i am moving my entire organization off bb becuase of this.
    have spent many many hours from the beginning in may, and now they want me to pay a 129 dollar fee to get support when it has not worked right from the beginning.
    i bought an ipad today and i am absolutely blown away by how much better it is in every single way. dozens of bbs are going away now.
    slow, no.email, locks up all the time, stand by button restarts tablet, no bridging without total reload on both devices. why would i go through this anymore? it is costing my business a fortune with myself and my people trying to make the playbook work.
    we will get ipads and make more money.
    i have tried to stay loyal to bb, but after being told i have to pay for support
    when i did once get a connection through bridge, reply locked up everytime on an email. could not type.

    I would like to add my support to this comment.
    Strike 1) Bridging a BB 9700 with a PB is flaky at best. Even if you run the very latest software on both, it does not work properly. This is NOT a user issue but a programme/application issue. RIM software running on RIM hardware and O/S and NOT being able to connect properly = RIM fault.(see my other post: My Bridge connects, it exchanges data like passwords, number of unread emails and my playbook notifies me when someone calls my BB, but it does NOT unlock)
    Strike 2) All this used to work fine during the 90d grace suport period (apart from the flaky bluetooth issue that required a hard reboot of the BB whenever the connection was broken in a bad way)
    Strike 3) Now, after a PB OS upgrade (which I faithfully applied), several phone upgrades (due to another problem) and the latest Bridge application install, it all doesn't work anymore, 100 days after I bought the flipping thing. so I have a fancy ebook reader, not the productivity enhancing tool I can use on the go.
    So now I am stuck with a forum that can't help, a technical database that does not contain this support information and a broken RIM application on RIM Hardware and O/S that I paid a lot of money for. And now they want more to look at this incident????? I am sorry but if this was a problem caused by usage, configuration or any other user error, I could understand it. But this is all completely in RIMs ballpark. I have done everything right. It connects. It just DOES NOT WORK!!!!!
    As I said in my other post, an evaluation of the PB in my company is ongoing as a possible management tool by people I know quite well, as I work in the area, but my advice would definitely be to stay away until basic functionality like emails, attachments, calendars etcetera are all suitably solved and usable by the average manager with sausage fingers and no clue about bluetooth, hard reboots and who won't be able to hold down the power, + & - buttons at the same time as the fingers won't fit!!
    So RIM, get your finger out, open up an email support channel or get some qualified support people go through this forum and help those people who have shown faith in your products and who now have real problems with your software and hardware. DONT HIDE BEHIND A STUPID SUPPORT FEE - MAN UP TO YOUR PROBLEMS!!!

  • Removing punctuation from the beginning and end of a string

    I am working on a project for a "spell checking" program. So far the StringHash class is made, and the dictionary is read into a hash table. Then the document to be checked is specified via command line, the document scans through each word and checks to see if it is in the dictionary, if it is do nothing, if it is not then display it to console. The problem I am having is with a method in the main class. The method (I will post what I have so far) is called removePunct. The method should remove any punctuation from the beginning and the end of the string, nothing from the middle. Here is what I have so far:
    public static String removePunct(String word){
              StringBuilder wo = new StringBuilder(word);
              int x = (word.length()-1);
              if(!Character.isLetter(wo.charAt(0)))
                   wo.deleteCharAt(0);
              if(!Character.isLetter(wo.charAt(x)))
                   wo.deleteCharAt(x);
              return wo.toString();
    Any help would be much appreciated, I'm pretty certain the solution is either something completely different, or something so simple that I just missed it.

    The easiest way to do this is to just show you the actual file to be spell checked:
    -- outline --
    This directory contains Bison skeletons: the general shapes of the
    different parser kinds, that are specialized for specific grammars by
    the bison program.
    Currently, there are only three supported skeletons:
    - yacc.c
    It used to be named bison.simple: it corresponds to C Yacc
    compatible LALR(1) parsers.
    - lalr1.cc
    Produces a C++ parser class. It is still very experimental, and not
    yet supported. Please, subscribe to [email protected].
    - glr.c
    A Generalized LR C parser based on Bison's LALR(1) tables.
    These skeletons are the only ones supported by the Bison team.
    Because the interface between skeletons and the bison program is not
    finished, we are not bound to it. In particular, Bison is not
    mature enough for us to consider that ``foreign skeletons'' are
    supported.
    Copyright (C) 2002 Free Software Foundation, Inc.
    This file is part of GNU Bison.
    GNU Bison is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.
    GNU Bison is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with Bison; see the file COPYING. If not, write to
    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
    What I need the spell checker to do is read each word, and strip any beginning or ending punctuation, e.g. (c) would become c. Pretty much punctuation consists of anything that is not a letter, hence the use of isLetter. I can easily modify the method to remove all punctuation using regular expressions, but I only want the beginning and end characters removed.
    Example of words:
    -yacc.c would become yacc.c and is not in the dictionary so it would be printed.

Maybe you are looking for

  • Can we have a b2b webshop without Product catalog in it

    Hi Gurus, I have a scenario where I dont want to Product catalog on the webshop. Customers log in and just want to see the order history. How can I set this up. Please explain if this is possoble. Thank You

  • IC Webclient URL Link Problem

    Hi All experts, I was trying to create a URL link for individual invoice in IC Webclient showing in a table. My expectation is that when I click on this link, it would bring up or open another browser with the real invoice image apprearing. How can I

  • How to pass & update variable for each run in ODI

    Hi, I am new to the ODI. I am loading the data from src to trg table through interface. I want to maintain the '*create_run_cycle_id & update_run_cycle_id*' columns in the target table. For ex: during first run create_run_cycle_id value should be som

  • Third Party IP Phone

    HII, I am working with CCM 5.1 as a service Provider. One of my customer have a third party 3Com 2102. I can't register his phone in my register.I have some configured already that i attached with mail. plz. help me ..and tell me how to configure tha

  • Error Message: EdgeAnimate.exe - Entry Point Not Found

    I'm running 64 bit MS Vista Ultimate. My original download of Edge Animate ran okay . However after running the most recent update, Edge Animate will no longer launch. Below is the error message: EdgeAnimate.exe - Entry Point Not Found:The procedure