Who wants some easy Duke Points

this is copied directly from the Sun's Java Tutorial (see link):
http://java.sun.com/docs/books/tutorial/essential/io/formatting.html
is it a typo?
public class Root2 {
     public static void main(String[] args) {
          int i = 2;
          double r = Math.sqrt(i);
          System.out.format("The square root of %d is %f.%n", i,r);
the line starting with System.out..... gives me the error:
The method format(String, Object[]) in the type PrintStream is not applicable for the arguments
(String, int, double)
I changed things around and got it to work as follows:
public class Root2 {
     public static void main(String[] args) {
          int i = 7;
          double r = Math.sqrt(i);
          Number[] n = {Integer.valueOf(i),Double.valueOf(r)};
          System.out.format("The square root of %d is %f.%n", n);
}

actually - I started using java 1.6.0_02 and Ialso
tried 1.5.0_11 - I'm using eclipse 3.2.2Check your compiler settings.as kajbj said, check thecompiler settings, chances are they are set to compile to a compliance level of 1.4 (Window -> Java -> Compiler -> Compiler compliance level)
~Tim
EDIT: Too late again. Damn I am slow this AM :)

Similar Messages

  • Who wants some cash? not dukes, cash

    Hi,
    I'm having a problem with a piece of my code, it's not overly complex but it is non the less stumping me.
    The problem is with printing.
    If anyone is interested in earning some cash to sort this out for me I'll be happy to talk.
    This is my personal code - not works - but I want to get it working.<BR>
    If you're interested please post an email address and I'll contact you within minutes.
    thanks in advance,
    Ed.

    Hi,
    thanks for that. Don't know how I missed that.
    I've added the code you suggested and found that the
    PrintException.printStackTrace();
    wont compile, it reports an error with println. Should I have imported something for this?
    The other part of the error message did print out something rather interesting 'null'
    This made me wonder if the problem is that the JVM hasn't instantiated the object that I'm trying to use as my print job object.
    I have the following code:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import javax.swing.JInternalFrame;
    import java.util.StringTokenizer;
    import javax.swing.JInternalFrame;
    import javax.swing.*;
    public class printControl extends JInternalFrame implements ActionListener {
    public String strClass;
    public templatePrint pt;
    public finalPrint pf;
    then a few lines later :
    pt = new templatePrint();
    pf = new finalPrint();
    pt.addActionListener(this);
    pf.addActionListener(this);
    Container pane = getContentPane();
    pane.setLayout(null);
    pane.add(pt);
    pane.add(pf);
    Insets inset = pane.getInsets();
    pt.setBounds(40 + inset.left, 25 + inset.top, 105,40);
    pf.setBounds(190 + inset.left, 25 + inset.top, 105,40);
    blah blah...
    then my action performed code.
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() instanceof Button) {   
    PrinterJob printJob = PrinterJob.getPrinterJob();
    if (printJob.printDialog()){
    System.out.println(e.getSource().getClass().getName() + " button name");
    if (e.getSource().getClass().getName() == "templatePrint"){
    printJob.setPrintable((templatePrint) e.getSource());
    try { printJob.print(); } catch (Exception PrintException)
    System.out.println(PrintException.getMessage()); // + PrintException.printStackTrace();
    else
    printJob.setPrintable((finalPrint) e.getSource());
    try { printJob.print(); } catch (Exception PrintException)
    System.out.println(PrintException.getMessage()); // + PrintException.printStackTrace();
    Incidentally, this is really my first advenure with printing and I have acquired all of my Java knowledge from a couple of books so far (hence some thicky mistakes).
    thanks in advance, it is appreciated.

  • Who wants some popcorn?

    It's good to have some snack while browsing the forum and waiting for a Good news.

    ...And we are working hard to provide those good news
    Have a good weekend!
    Francis.

  • Hey, I have $2350-2400 and I want some proper guidance for the macbook pro

    HEY!!!
    Guys I will try to make this as easy as possible!
    First let me tell you I am 15, I love graphics, music and literature and I have no credit card, my iTunes account has no money, I'm using an account that doesn't require credit cards! So (ugh) I buy all the free apps
    Anyway
    Dad gave me $2400 to buy a macbook pro and keep the change but since I live in Italy, I have to convert them to Euros.
    $2400-1821 EUR
    So I came up with 2 conclusions and I just want some opinions on which is the smarter decision.
    Well apparently there are 4 types of laptops I can get right now from the macs.....
    to make this as simple and as easy as possible (and to show off my ICT skills ) I made a table which includes
    1) the laptop mentioned
    2) the price in dollars (which I got directly from the apple store in the US)
    3) the price in euros (which I got directly from the apple store in Europe)
    Macbook Pro Kind
    Price in dollars
    Price in EUR
    13-inch: 2.5GHz
    $1119.00
    1249.00 EUR
    13-inch: 2.9GHz
    $1499.00
    1549.00 EUR
    13-inch: 2.5GHz with Retina Display
    $1499.00
    1549.00 EUR
    13-inch: 2.6GHz with Retina Display
    $1699.00
    1749.00 EUR
    But you can install somethings on to your laptop right there in the shop and I wanted two things,
    1) pages: I thought would help with my writing because I write poems, novels, stories, etc
    2) numbers: this program just deals with spreadsheets and charts and just the mathematical area and thought that this would help when doing A levels and GCSE math
    3)keynote: This is basically like power point and it just makes presentations.
    each of these programs are 18 EUR
    One more thing, since I am planning on using this laptop for several years, I change  changing countries often and so the laptop can come with an adapter that works in both European and American countries
    But thats 80 EUR
    The laptop (the edition i want) is 1749 EUR
    that means with all these additional stuff
    I calculated it on the apple store
    1749.00 EUR + 18 EUR + 18 EUR+ 18 EUR 80 EUR = 1883.01 EUR
    If we were in america then according to the website's store
    $1699 + $19.99 + $19.99 + $19.99 + $79.00=  $1847.96
    I'd be buying the SAME amount of things in the States for $1847.96 and I'd have 552 dollars change but in Italy everything would cost 1883.01 EUR which is the equivalent of $2481.61 which is more expensive than the US!
    BUT
    You have to consider the fact that this is with all the additional costs
    The additional things I thought I'd need
    If I said "no just buy the laptop"
    then the correct price in dollars is $1699
    the correct price in euros would be 1749 EUR
    the laptop only. No extra features.
    1749 EUR in Dollars would be $2305!
    Exactly $2305!
    That means I would only have had 95 dollars difference.
    Anyway the bottom line is all these additional things that I was talking about, the softwares and everything, they're going to help me in the near future, not RIGHT now.
    So what I can do is just buy the laptop and then as I progress in to year eleven, slowly by slowly, I can start buying the softwares.
    I'm sorry I'm unburdening ALL these different information on you, but I just wanted to approach this from as many angles and be as aware of all the variables as possible.
    SOOOOOOOOOOOOOOOOOOOOO
    (THIS IS THE CONCLUSION)
    OPTION ONE
    Buy the 13-inch: 2.6GHz with Retina Display Macbook Pro for 1749.00 EUR including all the additional features (the three softwares and the adapter which together have the total value of 134 EUR)
    Therefore the total amount of money we'd be spending is
    1883.01 EUR
    That means the total cost of everything would be $2481.62 and I'd get no difference
    OPTION TWO
    Buy the 13-inch: 2.6GHz with Retina Display Macbook Pro for 1749.00 EUR and then when I am 16 or 18 I buy these softwares with a credit card and apply them for my A levels later.
    That means the total amount we'll be spending is
    1749.00 EUR
    Which is $2305
    I will have $95 (72 EUR) pocket money.
    (BY THE WAY, MY PARENTS WORK FOR THE UNITED NATIONS AND DON'T PAY VAT OR SOMETHING AND SO WE KIND OF SOMEHOW GET A 20% DISCOUNT SO THE PRICES WILL BE A BIT OFF AND CHEAPER.... I JUST CAN'T BE BOTHERED TO DO ALL OF THE CALCULATIONS BUT YEAH.....................)
    Thanks for reading
    Please reply ASAP I'm buying the mac extremley soon.....

    Never heard of .MOD format, but generally VLC player will play most any format.
    It's free, open source so no harm in trying:
    http://www.videolan.org/vlc/

  • Who wants to have fun problem solving a more complicated issue?

    My main problem is I don't have permissions to access a Time Machine back up of all my files.
    Here's what happen: I was looking one day at how much space I was taking up with my 2009 MBP. I had about 209 GB of "other". Curious as to what this "other" was I ran Disk Inventory X to find out, but I ran into a problem. I inherited this computer from my mother who at some point turned on FileVault. Well FileVault wouldn't let me find out what that "other" space was, so I decided to try to disable it. But I could not disable it without 117 GB of free space. Unfortuantely all this "other" space took up so much that I couldn't free up enough space. I'm not exactly sure how, but somehow I finally figured out that it was a Sparse Disk Budle Image that was taking up the space. I did some research to try and figure out what this was and in my research determined it was a copy of basically everything on my computer. I had a back up of everything so I thought I could delete it all and be fine. So I did. When I did that it basically made my account unuseable because my info was wrong and all kinds of crazy stuff started happening. So I jut decided to re-image it with Mountain Lion. Now that I have re-imaged it all everything is new again I am trying to get my information back on. I understand that if I back up from Time Machine it will probably put back on FileVault, thus throwing this situation into a loop, so I don't want to do that. I really just want my 20 GB of photos back from my iPhoto library, but everytime I try to access my User account on my external hard drive it tells me I don't have permission. I tried to go into Disk Ultility and and repair permissions but it is greyed out. I'm out of ideas... I'm not computer illiterate, I actually work for an Apple reseller so I know my stuff on this. But i think I messed everything up when I deleted the Sparse Disk. I don't know. Can someone help me?

    The sparsebundle was the backing store of your FV home directory. When you deleted it, you destroyed all your data. Legacy FV has poor compatibility with Time Machine. The sparsebundle is backed up only when you log out. You'll have to find the last such snapshot and restore from it.

  • This is for people who wants to mirror all they apple devices when they travel.

    this is for people who wants to mirror all they apple devices when they travel and don't want to unplug everything from the apple tv and take it with them, you can get the amazon fire tv stick and download an app called airplay upnp or the reflector app and mirror all of your apple devices to it, it is great for traveling easy to setup and move around, for example if your traveling and want to use it in the conference room and then want to take with you back to the hotel for the night and plug it in and keep on doing that routine.
    it will be great to use hopeful until apple comes out apple with their own apple tv stick 

    The Verizon DVR is admittedly not the sharpest box on the market. I admit to giving up on the multi-room DVR product, it just never worked satisfactorily for me.
    Hopefully features/functions issues  will improve in the near term with the Cisco/Scientific Atlanta box that obviously isn't going to make Q1. I admit I have ceased  holding my breath. Something does have to happen fairly soon because 160gb drives are literally going out of production.
    You do however make two statements that incorrect. Current TiVO's only need 1 cable card, since the standard cable card today in Verizon's stock  is the M-Card. You also have the option with TiVO of paying either an annual fee, or a one time fee, both of which are lower in the long term than the month to month fee. Alternatively you can by the Moxi DVR, and it includes lifetime service in the purchase price.
    While in theory a truck roll costs $79, in practice if it is for a Cable Card install, it is free (I think  FCC regulations preclude the charge).
    Apparently there is nothing in Verizon's order processing system that tells reps that there is no charge for Cable Card installations, so they often quote the $79 fee because that is the standard charge for technician to come out. As far as I can tell (and there have been lots of posts about cable card installs), no one has in fact been charged the $79 fee..

  • Who wants to be a billionaire ?

    Im busy desinging a game...Who Wants To Be A Billionaire...but
    could someone explain why the following won't draw the Round Rectangles that i ask to be drawn...
    // Main Application Class
    import java.awt.*;
    import BuildCanvas.*;
    public class User
    public static void main (String [] args)
    MakeWindow userInterface = new MakeWindow ();
    userInterface.setSize (800, 600);
    userInterface.setLocation (100, 100);
    // The MakeWindow Class
    import java.awt.*;
    import java.lang.*;
    class MakeWindow extends Frame
    Button finalButton, fiftyButton, phoneButton, askButton, retireButton;
    MenuItem quitItem, newGameItem, helpItem, aboutItem, greenItem, blueItem;
    public MakeWindow ()
    super ("Who Wants To Be A Billionaire");
    // Create the menu items.
    newGameItem = new MenuItem ("New Game");
    quitItem = new MenuItem ("Quit Billionaire");
    helpItem = new MenuItem ("Help");
    aboutItem = new MenuItem ("About");
    // Create the menus.
    Menu mainMenu = new Menu ("File");
    Menu helpMenu = new Menu ("Help");
    // Place the menu items in the menus.
    mainMenu.add (newGameItem);
    mainMenu.add (quitItem);
    helpMenu.add (helpItem);
    helpMenu.add (aboutItem);
    // Place the menus into the menu bar.
    MenuBar myMenus = new MenuBar ();
    myMenus.add (mainMenu);
    myMenus.add (helpMenu);
    setMenuBar (myMenus);
    setBackground (Color.blue);
    pack ();
    show ();
    // Call button method.
    makeButton (finalButton, 180, 550, "Final Answer");
    makeButton (fiftyButton, 270, 550, "50 / 50");
    makeButton (phoneButton, 360, 550, "Phone Friend");
    makeButton (askButton, 450, 550, "Audience");
    makeButton (retireButton, 540, 550, "Retire");
    remainingButtons ();
    } // MakeWindow constructor.
    private void remainingButtons ()
    // Creates windows for Money Ladder and Answer Boxes.
    Graphics g = getGraphics ();
    g.setColor (Color.black);
    g.fillRoundRect (200, 200, 300, 300, 7, 7);                    //**** This Code doesnt work
    g.fillRoundRect (100, 300, 50, 100, 7, 7);                    //**** This Code doesnt work
    g.fillRoundRect (100, 200, 50, 200, 7, 7);                    //**** This Code doesnt work
    // Creates, positions + sets size of buttons.
    private void makeButton (Button currentButton, int posx, int posy, String buttonText)
    currentButton = new Button (buttonText);
    add (currentButton);
    currentButton.setSize (80, 20);
    currentButton.setLocation (posx, posy);
    } // makeButton method.
    have i forgotten to call something ?
    please help me asap.
    thanks
    andrew.

    I took the liberty to make some change, (the black rectangles overlaps)
    import java.awt.*;
    import java.awt.event.*;
    class MakeWindow extends Frame
         Button   finalButton, fiftyButton, phoneButton, askButton, retireButton;
         MenuItem quitItem, newGameItem, helpItem, aboutItem, greenItem, blueItem;
    public MakeWindow ()
         super ("Who Wants To Be A Billionaire");
         setLayout(null);
         addWindowListener(new WindowAdapter()
        {     public void windowClosing(WindowEvent ev)
              {     dispose();
                   System.exit(0);
    // Create the menu items.
         newGameItem = new MenuItem ("New Game");
         quitItem    = new MenuItem ("Quit Billionaire");
         helpItem    = new MenuItem ("Help");
         aboutItem   = new MenuItem ("About");
    // Create the menus.
         Menu mainMenu = new Menu ("File");
         Menu helpMenu = new Menu ("Help");
    // Place the menu items in the menus.
         mainMenu.add (newGameItem);
         mainMenu.add (quitItem);
         helpMenu.add (helpItem);
         helpMenu.add (aboutItem);
    // Place the menus into the menu bar.
         MenuBar myMenus = new MenuBar ();
         myMenus.add (mainMenu);
         myMenus.add (helpMenu);
         setMenuBar (myMenus);
         setBackground (Color.blue);
    // Call button method.
         makeButton(finalButton,180,550,"Final Answer");
         makeButton(fiftyButton,270,550,"50 / 50");
         makeButton(phoneButton,360,550,"Phone Friend");
         makeButton(askButton,450, 550,"Audience");
         makeButton(retireButton,540,550,"Retire");
         setVisible(true);
    // Creates, positions + sets size of buttons.
    private void makeButton(Button currentButton, int posx, int posy, String buttonText)
         currentButton = new Button(buttonText);
         add(currentButton);
         currentButton.setSize (80, 20);
         currentButton.setLocation(posx, posy);
    public void paint(Graphics g)
         g.setColor (Color.black);
         g.fillRoundRect (200, 200, 300, 300, 7, 7); //**** This Code doesnt work
         g.fillRoundRect (100, 300, 50, 100, 7, 7); //**** This Code doesnt work
         g.fillRoundRect (100, 200, 50, 200, 7, 7); //**** This Code doesnt work
    public static void main (String [] args)
         MakeWindow userInterface = new MakeWindow ();
         userInterface.setSize (700, 600);
         userInterface.setLocation (10, 10);
    }

  • Who wants to be a millionaire - uploading onto website

    Hi everyone,
    I'm very new to Adobe Captivate. I've created a Who wants to be a Millionaire game on Captivate 8 and would like to know exactly how I would upload it onto my webpage. I've configured it and created an HTML5 folder but am stuck on what next to do. Any help would be really appreciated.
    Many thanks in advance
    Dan

    For this interactive interaction the value of the score will be stored in the associated variable (do not forget to create it, will label it v_mil).
    Failure means that you don't get the total score, right? And since you only want to retake at the end, I suppose that is on another slide? Then it is easy, you just have to make a 'button' visible on that slide if the score is lower than the total score. That can be done On Enter for that slide:
    IF v_mil is less than v_total    you can put the exact total score here, or store that score in another user variable v_total
       Show Bt_Retake                 where that is the button that is initially invisible
    ELSE
       Continue
    The button has to trigger a simple action 'Jump to ...' to get back to the slide with the game, it will be automatically reset.

  • Why do some of the points break after i do the pattern brush on a shape?

    This are the steps that i do....
    1. I make a shape, then save it as a new patter brush, simple.
    2. Then i want to use that brush on circle, to make something like Mandala shape.
    3. When i zoom in, i see that some of the points get disconnected, its like they break, i really hope you know what i mean.
    I'm using the Ilustrator CS.5 version,
    Probably one of the stupidest questions here, but i found so many helpful things here that i never needed to ask, but now I'm the one asking
    Anyway, thank you all in advance!

    Rik Ham,
    I am unable to edit the previous post for some reason, so this is a continuation.
    The Butt Caps meet at the end Anchor Points, and have a gap on the outside and an overlap on the inside.
    When you Expand (Appearance), you will get separate paths which you can join so that the ends meeting with Caps are replaced by Joins, and in that case you can use Miter Joins which correspond to the Butt Caps that you have, if you wish to have sharp corners; you may have to adjust the Miter Linit (increase it) if you have a very sharp (acute) angle, to avoid a double (chamfered) corner.

  • Multi provider we have many cubes,but i want some of that how to fllter?

    multi provider we have many cubes,but i want some of that how to fllter?

    In the queries bring the 0INFOPROV (infoprovider) characteristic and restrict it your desired infocube or dso used in multiprovider.
    Hope this helps.

  • How can I set up a guest access point with a Time Capsule and an Airport Extreme? I am using a Telus router with the Time Capsule used as a wireless access point (bridge mode). I don't want the guest access point to have access to my network.

    How can I set up a guest access point with a Time Capsule and an Airport Extreme? I am using a Telus router with the Time Capsule used as a wireless access point (bridge mode). I don't want the guest access point to have access to my network.

    The Guest Network function of the Time Capsule and AirPort Extreme cannot be enabled when the device is in Bridge Mode. Unfortunately, with another router...the Telus...upstream on your network, Bridge Mode is indicated as the correct setting for all other routers on the network.
    If you can replace the Telus gateway with a simple modem (that performs no routing functions), you should be able to configure either the Time Capsule or the AirPort Extreme....whichever is connected to the modem....to provide a Guest Network.

  • I have a music library on an iMac and I got a new iPhone and a new MacBook Pro and I want some of the songs from the iMac library to be on my phone and my MacBook Pro and I have a new Apple ID on my phone and my Mac book pro

    I have a music library on an iMac and I got a new iPhone and a new MacBook Pro and I want some of the songs from the iMac library to be on my phone and my MacBook Pro and I have a new Apple ID on my phone and my Mac book pro, is this possible if so how do I do it?

    Providing specifics on all the ways to do this will take more time than I am willing to spend here these days.  You can do some of this with Home Sharing.  You can transfer the entire library from one computer to another, If you do that you can delete what you don't want from the transferred library.
    Quick answer if you use iTunes' default preferences settings: Copy the entire iTunes folder (and in doing so all its subfolders and files) intact to the other drive. Open iTunes and immediately hold down the option (alt) key (shift on Windows) so you get a prompt to select a library, then guide it to the 'iTunes Library.itl' file in the moved iTunes folder. If you put the copied iTunes folder in the default location of Macintosh HD > Users > *User Name* > Music then you don't even need to start with the option key held down, iTunes will automatically look for it there. (Make sure there isn't anything already in the iTunes folder there that you want to keep since you will be replacing it with the one you are moving.)
    You do not want to use a new AppleID.  Change the  AppleID on the new phone to the old ID.  Purchases made with one AppleID cannot be transferred to a different one and it will be a royal pain to manage two Apple IDs.
    Change iTunes Store account on an iOS device - Log out of your current account with Settings.app > Store (Settings > iTunes & App Stores on iOS 6) > tap on your AppleID. Log in with a different account. Note, turning on automatic downloads or re-download past purchases may tie the device to that account for 90 days - http://support.apple.com/kb/HT4627 https://discussions.apple.com/message/18484935 - "In order to change your Apple ID or password for your iCloud account on your iOS device, you need to delete the account from your iOS device first, then add it back using your updated details. (Settings > iCloud, scroll down and hit "Delete Account") When you delete your account, all the data that is synced with iCloud will also be deleted from the device (but not from iCloud), but will be synced back to your device when you login again."

  • I want sap easy access screen as an iview in the portal

    Hi ,
        I want sap easy access screen as a iview in portal ,how can i do it.
    I used SESSION_MANAGER tcode and created a transaction iview but it is going to rs00 tcode screen,
    PLZ help me

    Hi
    I have created an iview with tcode Session_Manager and it is working fine.What is this txn rs00? When I check this tcode in our ECC 6.0 system, it says rs00 does not exist.
    Check your system setting and iview config again.
    Regards
    Prabhakar Lal

  • Looking for software that allows you to make "who wants to be a millionaire".  Must be able to put in your own questions and HAS to be for the Mac.  Help!

    I am a teacher who would love to create the game "who wants to be a millionaire" with my own questions.  I would use this for test reviews.  I can't not find something for the mac.  It is out there for the PC, but my class room is mac based.  I can't use anything that will allow me to run the mac in windows, either.  Anyone know of a software that will allow me to input my own questions?  Thank you very much for your time and consideration.

    You may possibly find something here:
    http://www.oneonlinegames.com/who-wants-to-be-a-millionaire-games
    but in any case beware of copyright.

  • I have brought a 17'' MacBook Pro 2.5ghz core 2 duo 2gb. Model A1261. It seems I can upgrade to either 8gb or 16gb ram! But since It's 2006'ish, I just want some advice on the best ram that would work for a good price. Thanks :)

    I have brought a 17'' MacBook Pro 2.5ghz core 2 duo 2gb. Model A1261. It seems I can upgrade to either 8gb or 16gb ram! But since It's 2006'ish, I just want some advice on the best ram that would work for a good price. Thanks :)

    Keiran420 wrote:
    8 gb will do I guess
    Based on the information that you have supplied, you have a Early or Late 2008 MBP.  Maximum RAM that it will accept is 6 GB with the following specifications:   200-pin PC2-5300 (667MHz) DDR2 SO-DIMM.
    The best sources for Mac compatible RAM are OWC and Crucial.
    Ciao.

Maybe you are looking for