Can I get 2 return datatypes from a method?

I am looking to get a int from a method but also need a boolean value to indicate if it is a valid number which is tested in my method. If it is allowed must I declare the method twice for each datatype?
Edited by: Yucca on Apr 19, 2008 5:26 PM

Hi jverd. This is part of my program from last night. I do test in the method for valid value and throw an exception. However if I leave it at that it will still update my object with value and furthe update my ArrayList with the onject. This is not correct. As u see in my code I am already testing my arrayList with a boolean value and find that if I continue so it will be beneficial as I still have 2 more datatypes that need to be tested.
public void createNew()
     { // start of createNew()
          Person p = new Person();
          String firstName = getName("Create");
          String lastName = getSurname();
          int homeNum = getHome();
          int count =0;
          boolean found = false;
          //Test if the contact is in phonelist already
          for(Person c: phoneList)
               c = phoneList.get(count);
               if((c.name).equals(firstName.trim().toUpperCase())&&(c.surname).equals(lastName.trim().toUpperCase()))
                    JOptionPane.showMessageDialog(null,"You may not enter duplicate contacts. \nPlease abbreviate or change the contacts name/surname.","Error",JOptionPane.ERROR_MESSAGE);
                    found = true;
                    createNew();
                    break;
               count ++;
          // If contact is not in list the update it
          if(found == false)
               p.name = firstName.trim().toUpperCase();
               p.surname = lastName.trim().toUpperCase();
               phoneList.add(p);
public int getHome()
          int homeNum = 0;
          String home = JOptionPane.showInputDialog(null,"Please enter the contacts home number or press cancel to exit.");
          //If a string was entered make sure it is a integer
          if(home.length() > 0)
               try
                    homeNum = Integer.parseInt(home);
               catch(NumberFormatException nfe)
                    JOptionPane.showMessageDialog(null,"You may not use letters as a phone number. Please try again","Error",JOptionPane.ERROR_MESSAGE);
          return homeNum;
     }I want the getHome method to return a boolean value to and pass it up to the part where I test for corectness before updating the arrayList.

Similar Messages

  • Recently, I can't get any sound from my game applications.  Sound works fine with video, streaming, etc, but not my game applications.  I've tried powering down and re-booting, but the sound does not return.  Can anyone help me?

    Recently, I can't get any sound from my game applications.  Sound works fine with video, streaming, etc, but not my game applications.  I've tried powering down and re-booting, but the sound does not return.  Can anyone help me?

    Have you got notifications muted ? Only notifications (including games) get muted, so the Music and Videos apps, and headphones, still get sound.
    Depending on what you've got Settings > General > Use Side Switch To set to (mute or rotation lock), then you can mute notifications by the switch on the right hand side of the iPad above the volume switch, or via control centre : swipe up from the bottom edge of the screen and it's the right-most of the 5 icons in the middle of it (if the icon is white then it's 'on', tap it to turn it grey and 'off'). The function that isn't on the side switch is set via control centre instead : http://support.apple.com/kb/HT4085

  • How can I get sigalg attribute from a given X509 certificate

    Hi,
    I am verifying my client's digigital signature like this
    String sigalg = "SHA1WithRSA";
    Signature sig = Signature.getInstance(sigalg);
    sig.initVerify(pubKey);
    sig.update(sEnvelope.getBody().toString().getBytes());
    return sig.verify(Base64.decode(sigValue));
    while getting signature instance, rightnow I am hardcoding that to "SHA!withRSA", because I know that client is comming with that signatureAlgorithm, If another client comes with another alogorithm say "MD5withRSA", it is going to be failed. how can I change that sigAlg variable dynamically, based on different signature ?? what I have from the client is certificate file. how can I get signature algorithm from the certificate or from publicKey object ??
    Thanx, Venu

    Check the following methods in X509Certificate:
    getSigAlgName
    getSigAlgOID

  • Can you get values back from a stored procedure via OUTPUT parameters?

    Can you get values back from calling a stored procedure via OUTPUT parameters/variables? I call the SP via a SQL statement from a script either in a WF or DF.
    I thought I read some reference that DI could not get the values from OUTPUT parameters but I could not find it again (don't know if it is in any of the documentation or referred to in a forum.
    I did try a couple of tests but it did not reutrn any values via OUTPUT. But before I give up I thought I'd see if you could and maybe I needed to change something.

    This isn't exactly an answer to your question, but I'll point out that, given that you're resorting to a SQL script in the first place, there's no reason you can't also turn the output parameters into a regular result or record set. (The following uses T-SQL, although I think it's pretty generic.)
    declare @param1 int, param2 varchar(100), @return int;
    exec @return = proc @param1 = @param1 output, @param2 = @param2 output;
    select @param1 as param1, @param2 as param2;
    That is, to get from output parameters to a "regular" output from the SQL script isn't much of a leap...
    Jeff Prenevost
    BI Consultant
    Ann Arbor, MI

  • I have an iPod Classic and the latest version of iTunes. I make all my purchases on my computer, but when I try to click the "add to" option and transfer the songs to my iPod, it doesn't work. How can I get my songs from my computer to my iPod?

    I have an iPod Classic and the latest version of iTunes. I make all my purchases on my computer, but when I try to click the "add to" option and transfer the songs to my iPod, it doesn't work. How can I get my songs from my computer to my iPod?

    See this excellent user tip from another forum member turingtest2 outlining the different methods and software available to help you copy content from your iPod back to your PC and into iTunes.
    Recovering your iTunes library from your iPod or iOS device
    B-rock

  • How Can we get the data from Non-SAP to SAP in WebDynpro

    Hi,
    I hope u understand my query, How can we get the data from Non-SAP to SAP thru WebDynpro Programming.
    Help out with the steps for getting the data or procedure.
    Regards,
    Mutyapu

    You can expose the APIs in the Non-SAP backend as Web Services, and consume them in SAP by creating an Enterprise Proxy. Then these can be called just like normal class methods from Web Dynpro.
    Regards,
    Nithya

  • How can I get the events from a java program?

    I want to make a monitor to watch a java program.How can I get the events from the GUI of this program some as mouse cliking, keyinput. So I can watch these in my monitor.
    Thanks

    Hi,
    To put a monitor to the events occuring in the GHUI u need to register required components with the appropriate EventListeners.
    Liek if u want to get notified when a mouse is clicked, then u need to add The MouseListener to the component which u want to be monitored.
    Say
    myFrame which is the JFrame object which shuld be monitored for the events.
    Then in ur program u have to add following code
    myFrame.addMouseListener( someObectReference );
    Here the someObjectReference should be an instance to a concrete class ..i.e. U write a class like the following
    public class MyMouseListener implements MouseListener {
    // override the followig methods
    public void mouseClicked(MouseEvent me){ sop("MOUSE CLICKED ON THE FRAME");}
    public void mousePressed(MouseEvent me){}
    public void mouseReleased(MouseEvent me){}
    If u dont want to use another class for listening to the events. Then u can make teh current class monitor the events. To do so ur class should implement the appropriate listener and should override the required methods.
    and u should say myFrame.addMouseListenet( this );
    thats it

  • How can I get the InsertionPoint with FindText method.

    Hi All:
    In indesing script, I can find "abc text" with FindText method, and I want to insert a image here, but how can I get the insertionPoint(the FindText method return an object)? any help?
    Thanks in advance.

    What seems to be the problem?
    >app.findTextPreferences.findWhat = "text";
    >text = app.activeDocument.findText();
    >alert ("insertionpt "+text[0].insertionPoints[0].horizontalOffset);
    gives (as expected) the horizontal position of the first occurrance of "the".
    Note that findText returns an
    i array
    of found items; its length may be 0 (not found), 1 (only found once), or any other number.
    InsertionPoints is
    i also
    an array. Perhaps you expected it to be 'the' position of the found text -- it doesn't. It's an array of all insertion points in the found text.
    'The' position of the text (in its parent text) is something like text[0].index ("The index of the Text in the collection or parent object.")

  • How can I get return to 10.6? Uninstall yosemite

    How can I get return to 10.6? Uninstall yosemite

    Clean Install of Snow Leopard
    Be sure to make a backup first because the following procedure will erase
    the drive and everything on it.
         1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
             with your computer.  Insert the disc into the optical drive and restart the computer.
             After the chime press and hold down the  "C" key.  Release the key when you see
             a small spinning gear appear below the dark gray Apple logo.
         2. After the installer loads select your language and click on the Continue
             button. When the menu bar appears select Disk Utility from the Utilities menu.
             After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
             size.)  Click on the Partition tab in the DU main window.  Set the number of
             partitions to one (1) from the Partitions drop down menu, click on Options button
             and select GUID, click on OK, then set the format type to MacOS Extended
             (Journaled, if supported), then click on the Apply button.
         3. When the formatting has completed quit DU and return to the installer.  Proceed
             with the OS X installation and follow the directions included with the installer.
         4. When the installation has completed your computer will Restart into the Setup
             Assistant. After you finish Setup Assistant will complete the installation after which
             you will be running a fresh install of OS X.  You can now begin the update process
             by opening Software Update and installing all recommended updates to bring your
             installation current.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.

  • ImageIO - javax.imageio.IIOException: Can't get input stream from URL

    Hi,
    I'm developing a program which accesses a given URL of an image and saves it to a file. However when I try this I get the following error:
    javax.imageio.IIOException: Can't get input stream from URL!
         at javax.imageio.ImageIO.read(Unknown Source)
         at ImageSave.main(ImageSave.java:12)
    Caused by: java.net.ConnectException: Connection timed out: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at sun.net.NetworkClient.doConnect(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.openServer(Unknown Source)
         at sun.net.www.http.HttpClient.<init>(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.http.HttpClient.New(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at java.net.URL.openStream(Unknown Source)
         ... 2 moreThe internet connection I am using uses a proxy server and I think this is where the problem lies. I'm using Eclipse version 3.3 and I've tried changing the network settings to use the proxy's hostname and port but this still isn't working. I've also tried using System.setProperty("http.proxyHost", "hostname") and System.setProperty("http.proxyPort", "port") but that hasn't worked for me either. Below is my class in full.
    import java.awt.image.*;
    import javax.imageio.*;
    import java.io.*;
    import java.net.*;
    public class ImageSave
         public static void main(String args[])
              try {
                   URL url = new URL("http://www.example.com/image.jpg");
                   BufferedImage image = ImageIO.read(url);
                   ImageIO.write(image, "JPG", new File("image.jpg"));
              catch (Exception e) {
                   e.printStackTrace();
    }The error occurs with the line: BufferedImage image = ImageIO.read(url);
    I have tried looking for a way to change how this specific method accesses the internet (e.g: a Proxy parameter with URLConnection) but there doesn't seem to be any.
    Any help or suggestions would be greatly appreciated.
    -Robert

    Ah, that worked fine. I had thought of using that earlier but I was under the impression that the input stream would be HTML rather than an actual image. Not sure why.. Anyway, thanks very much for your help!
    Here is the new code with your suggested revisions and a URLConnection to get the input stream:
    import java.awt.image.*;
    import javax.imageio.*;
    import java.io.*;
    import java.net.*;
    public class ImageSave
        public static void main(String args[])
            try {
                 // This is where you'd define the proxy's host name and port.
                 SocketAddress address = new InetSocketAddress(hostName, port);
                 // Create an HTTP Proxy using the above SocketAddress.
                 Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
                 URL url = new URL("www.example.com/image.jpg");
                 // Open a connection to the URL using the proxy information.
                 URLConnection conn = url.openConnection(proxy);
                 InputStream inStream = conn.getInputStream();
                 // BufferedImage image = ImageIO.read(url);
                 // Use the InputStream flavor of ImageIO.read() instead.
                 BufferedImage image = ImageIO.read(inStream);
                 ImageIO.write(image, "JPG", new File("image.jpg"));
            catch (Exception e) {
                 e.printStackTrace();
    }Edited by: Ragnarob on Apr 21, 2009 2:49 AM

  • I can not get link-value  from af:tree.

    Hello.
    I use jdeveloper 10g.
    I can not get link-value from tree.
    I use following code:
    <f:facet name="nodeStamp">
    <h:panelGroup binding="#{backing_dialogDic_dic_ETS.panelGroup1}"
    id="panelGroup1">
    <h:outputText value="#{item.vidNum} #{item.vidName}"
    binding="#{backing_dialogDic_dic_ETS.outputText1}"
    id="outputText1"/>
    <af:commandLink
    binding="#{backing_dialogDic_dic_ETS.commandLink2}"
    id="commandLink2"
    action="#{backing_dialogDic_dic_ETS.returnObject}">
    <af:setActionListener from="#{item.idVid}"
    to="#{processScope.ETSId}"/>
    <af:objectImage source="/images/icons/10.gif"
    shortDesc="Выбрать"
    binding="#{backing_dialogDic_dic_ETS.objectImage2}"
    id="objectImage2"/>
    </af:commandLink>
    </h:panelGroup>
    </f:facet>
    </af:tree>
    //in java bean:
    public String return_Object() {
    Object ob = JSFUtils.getManagedBeanValue("processScope.ETSId");
    System.out.println(o);
    return null;
    In console I see null.
    How I get this value???
    I can get this value if i use treeTable instead of tree.
    Thx, Dema.

    Hi,
    not that I think it matters, but the processScope is not a managed bean but a memory scope. So if
    JSFUtils.getManagedBeanValue("processScope.ETSId");
    assumes a managed bean then this may be incorrect as most likely there exist no managed bean with this name. You should be able to access the process scope from AdfFacesContext.getProcessScope(), which then returns a Map, which you call get("ETSId") on
    Frank

  • HT5312 My rescue email address is no longer used, I can't get any emails from apple about my security questions. What shall I do?

    My rescue email address is no longer used, I can't get any emails from apple about my security questions. What shall I do?

    You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (104597)

  • I have a shuffle and it dont work so i got a nano how can i get the music from the shuffle to the nano

    i have a shuffle and it dont work so i got a nano how can i get the music from the shuffle to the nano

    Hi tak661_99m,
    It sounds like you want to transfer music from your older iPod shuffle to iTunes and then sync it to the new iPod nano. Take a look at the article below for more information about transfering music from your device to iTunes. The way you transfer the music to the new iPod nano will vary depending on where the music came from and whatever is most convenient for you.
    iTunes: Transferring media from your iPhone, iPad, iPod touch, or iPod
    http://support.apple.com/kb/ht1209
    Media type
    Transfer method
    Music purchased from the iTunes Store
    Transfer your media through iTunes.
    Download your media through iTunes in the Cloud1.
    Download your media through iTunes Match2.
    Music imported from a CD or other source
    iTunes can't transfer this media back to your computer.
    Back up your iTunes library or use iTunes Match2.
    iTunes in the Cloud is supported on up to 10 devices:
    iPhone
    iPad
    iPod touch with iOS 4.3.3 or later
    iTunes for Mac or Windows 10.3 or later
    If you use an iPod classic, iPod nano, iPod shuffle, or earlier iPod model, use iTunes in the Cloud within iTunes on your computer. Previously purchased content may be unavailable if it's not in the iTunes Store. Learn more about
    downloading past purchases from the App Store, iBooks Store, and iTunes Store
    and
    which content types are supported for iTunes in the Cloud by country
    iTunes Match is supported on these devices:
    iPhone
    iPad
    iPod touch with iOS 5.0.1 or later
    iTunes for Mac or Windows 10.5.1 or later
    If you use an iPod classic, iPod nano, iPod shuffle, or earlier iPod model, use iTunes Match within iTunes on your computer. iTunes Match is subject to subscription purchase and
    availability
    . Learn more about
    subscriptions to iTunes Match
    -Jason

  • Can I get the language from device?

    with the adobe packager 3.0 can I get the language from device?
    thanks

    You can get the devices "Language" setting by looking at the first element of the array returned by Capabilities.languages.
    Unfortunately the codes returned don't seem to always match the standard naming convention for language codes.
    var languageSettings:Array = Capabilities.languages;
    if ( languageSettings.length > 0 )
        if ( (languageSettings[0]).toString().toLowerCase() == "en-gb" )
            // Do something based on the language being "British English" in this case.
    I still need a way to determine if the user is using Canadian English, but the device seems to only have 2 English settings (English and British English).
    There is a Canadian "Region Format" setting also under Settings->General->International->Region Format, but I'm not sure how to access that information.
    If anyone knows how to access the region format, I'd love to know.
    Thanks.

  • HT1848 how can i get the music from itunes on my pc to transfer to my iphone?

    how can i get the music from itunes on my pc to transfer to my iphone?

    The only supported method to get media onto an iDevice is via iTunes.  Read the User's Guide it will describe how to do this in detail.
    iCloud does not put media on the device, but using iTunes Match and iCloud it is possible to have access to all media that exists on your computer, but only when the device has Internet access.  It will not load media onto the device.
    Use of 3rd party tools to transfer files to the device is not supported.

Maybe you are looking for