I'd like a "goto" like in my method

here's my code:
     bl = true;
          do {
               // apresentar o problema
               try {
                    System.out.println(p1 + escolhido.getOperacao() + p2 + " ?");
               catch (NullPointerException npe) {
                    System.out.println("Escolha uma operacao valida!");
               try {
                    // ler a resposta
                    String input = ac.getResposta();//tem de estar aqui
                    // converter em valor num?rico
                    double valor = Double.parseDouble(input.trim());
                    double solucao = escolhido.getResultado(p1, p2);
                    double solucaoMesmo = solucao;
                    // responder
                    if (solucaoMesmo == valor) {
                         System.out.println("certo!");
                         bl = false;
                    else {
                         System.out.println("Tenta outra vez");
                         bl = true;
            catch (NumberFormatException badInput) {
                System.out.println ("Introduza um numero!");
          while (bl);if i dont use the 1rst try/catch a get a NPException, but the code, when the exception is catched, doesnt flow like it flows with the 2nd try/catch.
Beeing more concrete, if users inputs a '+' or '-', the app goes on asking for a numeric answer.
If user inputs something diferent than a number, the 2nd catch works and gives user the (terrestrial :)) oportunity to go on and have another chance.
This is the behaviour i'd like to my first try/catch (give user the oportunity to restart and input a '+' or '-'), but i just cant.
Can someone pls help me on this?

How about this:
bl = true;
          do {
               try {
                                System.out.println(p1 + escolhido.getOperacao() + p2 + " ?");
                    // ler a resposta
                    String input = ac.getResposta();//tem de estar aqui
                    // converter em valor num?rico
                    double valor = Double.parseDouble(input.trim());
                    double solucao = escolhido.getResultado(p1, p2);
                    double solucaoMesmo = solucao;
                    // responder
                    if (solucaoMesmo == valor) {
                         System.out.println("certo!");
                         bl = false;
                    else {
                         System.out.println("Tenta outra vez");
                         bl = true;
               } catch (NumberFormatException badInput) {
                           System.out.println ("Introduza um numero!");
                       }  catch (NullPointerException npe) {
                    System.out.println("Escolha uma operacao valida!");
          while (bl);

Similar Messages

  • Hi why do i getting the message like "Your payment method was declined"

    hi why do i get the message like "Your payment method was declined"

    What are you trying to use as your payment method, credit card, debit card ... ? If it's a debit card then I don't think that they are still accepted as a valid payment method in all countries - from this page :
    You may be able to use other payment types in your country, like debit and Maestro cards.
    which implies that they are not accepted in all countries, and there have been a number of posts about them being declined.
    For a card to have a chance of being accepted it needs to be registered to exactly the same name and address (including format and spacing etc) that you have on your iTunes account, and have been issued by a bank in the country where you and your iTunes account are. If it is then you could check with the card issuer to see if it's them that are declining it, and if not then try contacting iTunes Support (these are user-to-user forums) and see if they know why it's being declined (but you might not be able to use a debit card) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management

  • Can I Upgrade using like a "Migrate" method? OCS 9.1.4.2 to OCS 10.1.2

    We use OCS 9.1.4.2 for a year or more, and we want to upgrade to 10.1.2. On Upgrade Guide, all the paths instructs for upgrade services on same server. But I'd like to install OCS 10g on new servers (hardware), with a new OS (I'm using Suse SLES8 and want to install OCS 10g on SLES9), and do something like to a "migrate" data (email, calendar, files, ...) from my current OCS 9.4.0.2 servers to new 10g servers. Any ideas about the best way to do this??? Oracle have any "path" to do this kind of work? Thanks.

    I don't think Oracle has a path for this right now...
    I'm planning an upgrade from 9.0.4.2 to 10.1.2. I'll be mainly moving email and calendar. I'm working out the details now. But here are my thoughts...
    Migrating email...
    1. extract users (groups, etc) from 9.0.4.2 OID and import into 10.1.2 (lots of details to work out here)
    2. Then use an imap sync tool to sync email accounts between the two servers.
    Calendar (this ones not so easy).
    1. I'm planning on creating a new 9.0.4.2 installation (swing server) and coping the calendar users and data to that.
    2. Then perform a 10.1.2 upgrade on the swing server.
    3. Move the calendar data from the swing server to a new production installation of 10.1.2.
    If you're interested I can post the details as I move along... Or if you have a better idea, I'm listening...

  • Reverse proxy plugin does not like the POST method

    My second tier is not functionning properly when placed behind a S1WS6 with reverse proxy
    Client ====== SunOne web server with Passthrough ====== .NET app server & web services.
    The web server configuration (reverse proxy � libpassthrough.so) is configured and is working correctly when it comes to requesting normal pages, however a problem arises when the request is made either by:
    1- Invoking a web service on the .Net tier, or
    2- The .Net tier performs a server.transfer call within the same .net server (Page transfer)
    Keep in mind that the .Net tier works fine when not accessed through the reverse proxy.
    It seems that when a POST method is invoked, a Session Close is sent before data is sent back !!
    We tried to isolate the problem from different angles but came up short, the http server log shows that the request was made
    192.168.2.7 - - [14/Jul/2004:14:10:56 +0300] "POST /wavedms2.0/TestWebService/TestService.asmx HTTP/1.1" 100 0
    Although response 100 indicates that it is waiting for more, while the web service error shows the following:
    The underlying connection was closed: An unexpected error occurred on a receive.
    at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
    at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
    at TestWebService.oWebService.MyWebSvc.HelloWorld()
    at TestWebService.Form1.button1_Click(Object sender, EventArgs e)
    In general, any page that uses POST method faces the same problem.I appreciate any help you can provide us with a solution on this issue.

    The Application Server plugin, libpassthrough.so, was designed to connect Web Server to Application Server. Unfortunately, it does not work with IIS which sends unsolicited "HTTP/1.1 100 Continue" responses.

  • Overridden methods  run like an abstract method

    public class Mammal
    public int length;
    public Mammal(int b)
    this.length=b;
    public void speciesName()
    System.out.println("I am a mammal");
    public class Cat extends Mammal
    public Cat (int b)
    super(b);
    public void speciesName()
    System.out.println("I am a Cat");
    public class Goat extends Mammal
    public Goat(int b)
    super(b);
    public void speciesName()
    System.out.println("I am a Goat");
    public class Test
    public static void main(String[] args)
    Cat k=new Cat(50);
    Goat g=new Goat(60);
    Vector<Mammal> v=new Vector<Mammal>();
    v.add(k);
    v.add(g);
    Mammal m; //reference
    m=v.elementAt(0);
    m.speciesName();
    m=v.elementAt(1);
    m.speciesName();
    hello all,
    my problem about above code is:
    on the console : I am a Cat
    I am a Goat
    but i did not understand why the result is so this.
    i thought that the screen output must be : I am a Mammal
    I am a Mammal
    i supposed that Mammal class's speciesName() method must run.
    if speciesName() was abstract method, i could understand the result.
    but in this situation, i didn't understand how the output is this.
    thanks...

    khanD wrote:
    i thought that the screen output must be : I am a Mammal
    I am a Mammal
    i supposed that Mammal class's speciesName() method must run.
    if speciesName() was abstract method, i could understand the result.
    but in this situation, i didn't understand how the output is this.Now you know that it doesn't matter whether speciesName in Mammal is abstract or not. Overriding works the same regardless.
    But there are other differences. For example right now Mammal is concrete so you could create a Mammal object if you wanted. If you made speciesName abstract that would no longer be possible. Right now you also don't have to override speciesName in the subclasses. If speciesName were abstract you would have to do that.

  • How to access "Alternative Realm" or "Custom Realm" from components like Servlet ?

    Hello,
    Says if I have alternative realm or my custom realm which implement
    "ManageableRealm" interface. How can I access the realm from other
    component, like Servlet or EJB in same WLS ? I tried using code like this
    BasicRealm realm =
    Realm.getRealm("XmlRealm","weblogic","myclass.DebugRealm");
    if (realm != null) {
    Class realmClass = realm.getClass();
    out.println("Realm is " + realmClass.getName());
    Which "myclass.DebugRealm" is classname of my own realm. This realm works
    fine when using for authentication and authorization. But when I run this
    code on servlet, it seems that it doesn't return the realm it created when
    starting WLS, I mean the one that served authentication and authorization.
    But it create a new instance of this class (I knew it 'cos I put debug
    message in its constructor). So how can I get reference to the realm
    instance which is created when starting WLS ?
    Thank you in an advance,
    Siros

    Hello again,
    Sorry to say that now I've got the way. I post here again for someone who
    may face that same problem.
    So strange that, I just changed the realm name in below code to "custom" and
    then it works !! My realm is extended from "AbstractListableRealm" class and
    I think I named my realm as "XmlRealm" in it constructor by call
    super("XmlRealm");
    But seems like its "getName()" method always return "custom", so in servlet
    code, it' rather be.
    BasicRealm realm = Realm.getRealm("custom");
    if (realm != null) {
    Class realmClass = realm.getClass();
    out.println("Realm is " + realmClass.getName());
    This works fine and no instance of realm is created. Anyway I saw that
    constructor of "AbstractListableRealm" take String argument for "name" of
    the realm. So why it's always "custom" ???
    Comments are welcome,
    Siros
    "Siros Supavita" <[email protected]> wrote in message
    news:[email protected]..
    Hello,
    Says if I have alternative realm or my custom realm which implement
    "ManageableRealm" interface. How can I access the realm from other
    component, like Servlet or EJB in same WLS ? I tried using code like this
    BasicRealm realm =
    Realm.getRealm("XmlRealm","weblogic","myclass.DebugRealm");
    if (realm != null) {
    Class realmClass = realm.getClass();
    out.println("Realm is " + realmClass.getName());
    Which "myclass.DebugRealm" is classname of my own realm. This realm works
    fine when using for authentication and authorization. But when I run this
    code on servlet, it seems that it doesn't return the realm it created when
    starting WLS, I mean the one that served authentication and authorization.
    But it create a new instance of this class (I knew it 'cos I put debug
    message in its constructor). So how can I get reference to the realm
    instance which is created when starting WLS ?
    Thank you in an advance,
    Siros

  • Does ExtendScript have a concept of "main" function/method like when script is included as a library

    I was just wondering whether ExtendScript has any concept like a main method, whereby if the current script is included by another script like a library import it will not execute this main function/method and only execute it when the script is run directly.
    Similar to Java's main() method and Python's __main__.
    If not, is there a workaround to mimic such behavior generically?

    I cannot reproduce this.  Can you create a very simple repro of this issue and post to OneDrive?
    Jeff Sanders (MSFT)
    @jsandersrocks - Windows Store Developer Solutions
    @WSDevSol
    Getting Started With Windows Azure Mobile Services development?
    Click here
    Getting Started With Windows Phone or Store app development?
    Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

  • HELP :  using UPPER with LIKE in CMP finder??

    Hi,
    am trying to do a case insensitive wildcard search but am having little luck, if I run the sql query
    select * from my_view where UPPER(name) like '%SMI%'; then I get the right results back but when i try to use it in my CMP bean I get nothing unless the case matches.
    my xml entry is as below:
    <finder-method partial="False" query="SELECT * FROM MY_VIEW WHERE UPPER(name) LIKE ?1">
    <method>
    <ejb-name>View</ejb-name>
    <method-name>findByName</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </method>
    </finder-method>
    can anyone help please ?? can I not use UPPER in one of these queries ??
    Regards
    Rosie

    Rosie,
    I was able to get this example to work and it is nearly identical to yours. I passed "C%" into the bean and received all the records where the USR_MSG_CTGR_ID field started with "C". Is the problem a data issue? (Does the connection used by the bean use the same database and user ID that you used when you executed the query manually? If not, are they looking at the same table?)
    Good luck!
    <finder-method partial="False" query="select * from my_usr_msg where upper(usr_msg_ctgr_id) like ?1">
    <method>
    <ejb-name>My_usr_msg</ejb-name>
    <method-name>findByUpperValue</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    </method-params>
    </method>
    </finder-method>

  • Interface-like specification for construtors

    Consider this scenario: I want to instantiate one of the implementations of the interface Foo, the exact subclass being chosen at runtime based on user input. The constructor to be used (via Constructor.newInstance()) in such an instantiation has a non-zero argument list - say, SubFoo(double[] a, double[] b). The question is: is there a way (however sinuous it might be) to enforce that all implementations of Foo provide a (double[], double[]) constructor, as it would be if the constructor was a regular method of the interface, or from the moment I begin to use reflection all client programmers who wish to implement Foo are (other then for my documentation) on their own?

    ejp wrote:
    Why do you care? As long as you only provide a (double[], double[]) constructor in your abstract base class, so that subclasses must provide these values, why do you care what the constructors of the implementation classes look like?Because my design does not have, or otherwise need, an abstract base class, only the interface. For the regular methods of the interface there is no interest in providing a base implementation, as the implementing classes should be free to handle the messages however they wish. Same goes for my imaginary (double[], double[]) constructor - how the constructor arguments should be handled should be entirely up to the subclasses, since only they should know about their instance fields they need to initialize on construction. That means that (according to this design) the abstract base class constructor wouldn't use the arguments for anything useful to the subclasses. And then, as it is not possible to override constructors or make them abstract, it would be pretty much useless...
    Hopefully I managed to get across what I'm trying to do design-wise. While I understand that constructors can't be abstract like a regular method due to their special role and - for reasons I read about but didn't really understand - that having static interface methods is not possible as well, I believe what I am trying to achieve makes sense - after all, as far as semantics are concerned a public constructor/static factory method is part of the class' interface (not interface in the Java language construct sense, but in the design concept sense)...

  • Iweb how to use? where to get? Will I like it??

    Hi,
    My website was designed (by me) and put together by a 'real' website master.
    Now I want to be able to add or change items and pictures.
    Is this the right product for me?
    I am familiar with HTML and use iphoto extensively...would like an easy method for doing this work myself!
    Appreciate any and all help and suggestions.
    Thanks

    Welcome to the discussions joyful17
    You might like to take a look at www.iWebUserSites.com to see what others have done, also take a look at the i page, there are some links to iWeb tips and hints sites. These may give you an idea of what you can do through the iWeb interface, and things that you need to tweak the code post publishing to get your desired result.
    Will
    1GHz G4, 15" PowerBook, 1.5GB RAM, Airport Extreme & Express, 1G iPod Mini   Mac OS X (10.4.6)  
    Help others by marking solved questions as answered ( + Solved or Helpful )

  • Does CMP bean finder method supports "LIKE" sql?

    I put something like this in the orion-ejb-jar.xml file:
    <finder-method partial="false" query="select * from EMP where $ename like $1 AND $job like $2">
    </finder-method>
    If I put in exact value like 'ADAMS' or 'CLERK', it works fine. But if I put in 'A%' or 'CL%', it does not work. I know the record is there and the same sql does return a row in sql-plus.
    Appreciate any help.
    Adam

    I put something like this in the orion-ejb-jar.xml file:
    <finder-method partial="false" query="select * from EMP where $ename like $1 AND $job like $2">
    </finder-method>
    If I put in exact value like 'ADAMS' or 'CLERK', it works fine. But if I put in 'A%' or 'CL%', it does not work. I know the record is there and the same sql does return a row in sql-plus.
    Appreciate any help.
    Adam gday Adam -
    I don't think there is anything in the persistence manager that will prevent this from working as you want.
    Can I ask what version of OC4J you are using?
    I'm not sure from your email if you are you specifying the fields in the finder method by surrounding them with SQL style quotes as in 'A%'? You shouldn't need to do that if you are.
    I just tested it out with a simple client and entity bean based on the employee table, which I created in about 30 seconds with the new JDeveloper CMP Entity Bean Wizard, using the create from existing table option.
    I added a finder method that looks like the following:
    Collection findByEnameAndJob(String ename, String job) throws RemoteException, FinderException;
    And then changed the SQL in the finder dialog (or orion-ejb-jar.xml) for the finder to be
    <finder-method partial="False" query="select * from emp where $ename like $1 and $job like $2">
    <method>
    <ejb-name>Emp</ejb-name>
    <method-name>findByEnameAndJob</method-name>
    <method-params>
    <method-param>java.lang.String</method-param>
    <method-param>java.lang.String</method-param>
    </method-params>
    </method>
    </finder-method>
    The client code then looked for employees with a name starting with the letter A and whose job started with the letters CL as follows:
    Collection coll = empHome.findByEnameAndJob("A%","CL%");
    System.out.println("*** There were : " + coll.size() + " records returned ***");
    Iterator iter = coll.iterator();
    while (iter.hasNext())
    emp = (Emp)iter.next();
    System.out.println("empno = " + emp.getEmpno());
    System.out.println("ename = " + emp.getEname());
    When the client was run, this was the resulting output:
    *** There were : 1 records returned ***
    empno = 7876
    ename = ADAMS
    job = CLERK
    mgr = 7788
    hiredate = 1987-05-23 00:00:00.0
    sal = 1100
    comm = 0
    deptno = 20
    If you want to find all the entries that have a job that starts with CL you can even use the same finder method like:
    Collection coll = empHome.findByEnameAndJob("%","CL%");
    This results in the output
    *** There were : 4 records returned ***
    empno = 7369
    ename = SMITH
    job = CLERK
    mgr = 7902
    hiredate = 1980-12-17 00:00:00.0
    sal = 800
    comm = 0
    deptno = 20
    empno = 7876
    ename = ADAMS
    job = CLERK
    mgr = 7788
    hiredate = 1987-05-23 00:00:00.0
    sal = 1100
    comm = 0
    deptno = 20
    empno = 7900
    ename = JAMES
    job = CLERK
    mgr = 7698
    hiredate = 1981-12-03 00:00:00.0
    sal = 950
    comm = 0
    deptno = 30
    empno = 7934
    ename = MILLER
    job = CLERK
    mgr = 7782
    hiredate = 1982-01-23 00:00:00.0
    sal = 1300
    comm = 0
    deptno = 10
    I can send you the packaged EAR file if you want to try this simple example for yourself - or you I would even encourage you to grab JDeveloper 9i and see how it easy it makes it to build and test the example I was just working with.
    cheers!
    -steve

  • Is there any other way to buy pro apps like logic pro x or final cut pro x without downloading straight from the internet?

    Hi,
    Just straigt to the issue, I'm not really sure with my internet connection in my country. I mean its so slow and sometimes it disconnects and reconnect. So I'm not trusting the internet connection here to download such a big software like Logic Pro x or Final Cut Pro x. So is there any way for me to buy the pro apps without downloading straight from the internet? I mean like the oldschool method, come with a box. I bought Logic pro 7 and 8 like that and has no problem with it. But now apple selling all the pro apps from the app store, its cool and easy but im afraid if i bought it online and im pretty sure i will encounter problems during the download period. It might took me like a week or more maybe to download 40GB file, i dont know. And more over, what if my internet connection cut off while i download the software?
    So please do help me with this. I would love to have Logic Pro X on my apple computer.
    Thanks.

    ahavu wrote:
    And to my knowledge I can't sort of 'drag and drop' the clips from the sealed Final Cut event files either.
    The events are not "sealed". Your clips – if you copied rather than leaving in place  – are in the Original Media folder. If you used 10.1.x, you right click on the library bundle and choose Show Package Contents. In early versions, just open the event folder.
    There are multiple ways to get media on ones' computer. One way is to use a card reader and copy the entire card structure to whatever destination is used for a media drive. Then import into the NLE.
    I don't have any experience with Hitfilm but I assume their user forums would be a good place to get an understanding of what workflows work best for that application.
    Good luck.
    Russ

  • Does final method works like a inline function???

    Hi,
    in c and c++ we have macro and inline functions.
    In java u can not override final methods but My query is
    Does in java final methods wroks like inline methods ?
    Inline means the method call is replaced by method body at compile time so logically it improves the performance.
    I would like to know if final method works like an inkine method up to what extend it really improves the performance.
    Thanks in advance

    It depends.
    In Java it's mostly the VM (the JIT compiler, to be more exact) that handles the optimization. It may or may not inline methods, depending on which gives better performance.

  • How to create Black aspect ratio bars like in Final Cut Pro.

    I would like to know the best way to create the black aspect ratio bars the same way you can in FinalCut Pro. For example a 2.35:1 bars. Can some one assist. I dont know why this is not already a installed preset. Premeire CC is supposed to make our life easier.

    It's much easier to do this within PPro itself -- just use the crop filter and either make a preset or create a new sequence and add the crop effect to an adjustment layer, then copy that layer into any subsequent sequence. 
    In both methods, you have to do the rudimentary math, so it's not as if you save yourself anything by going to Photoshop.
    And you don't have to listen to that insufferable kid.....
    BTW, the aspect ratio filter in FCP was, at least in the earlier versions, a big problem:  moving the footage around to reframe it reduced resolution in many cases.  The workaround was a garbage matte -- pretty much like the PPro method.

  • Facebook Like Button for Individual Products

    I like the great method that Kiyuco adapted to use the 'AddThis' to do this, however, in some instances, for example, if you have grouped products, switching between products results on making the Like Button disappear.
    I am sure that this happens due to the JS Hack implemented within it.
    I know how to do this using PHP, however, we know the story about PHP and BC.
    I just want to know if someone came across a solution to get this done using the BC Facebook Like Module to target individual Products.
    Thanks.

    Allowing the visitor to ‘Like’ the current page is as simple as adding BC’s facebooklike module to the Large Individual Product layout (or anywhere else):
    {module_facebooklike, moduleTemplateGroup="", language="en_US", url="", layout="", showFaces="true", width="450", verb="like", font="", colorScheme=""}
    http://kb.worldsecuresystems.com/134/bc_1345.html#main_Social_Media_Modules
    To add the Facebook Like button to the Small Individual Product layout you’ll need to make a simple change. Go to ModuleTemplates > SocialMedia > FacebookLike > Default > container.html
    Copy the code in the container.html. It will look like this:
    <script src="http://connect.facebook.net/{tag_language}/all.js#xfbml=1"></script><fb:like href="{tag_url}" layout="{tag_layout}" show_faces="{tag_showfaces}" width="{tag_width}" action="{tag_verb}" font="{tag_font}" colorscheme="{tag_colorscheme}" send="{tag_sendbutton}"></fb:like>
    Paste it to the Small Individual Product layout. Change the tag_url to tag_itemurl_withhost. It will look like this:
    <script src="http://connect.facebook.net/{tag_language}/all.js#xfbml=1"></script><fb:like href="{tag_itemurl_withhost}" layout="{tag_layout}" show_faces="{tag_showfaces}" width="{tag_width}" action="{tag_verb}" font="{tag_font}" colorscheme="{tag_colorscheme}" send="{tag_sendbutton}"></fb:like>
    Changing the tags will allow people to like the individual product page without even going into it.

Maybe you are looking for

  • How to get JDev 10.1.2/ADF working with MS SQL Server Identity Column

    Hello JDevTeam & JDevelopers, I want to use JDev/ADF with a MS SQL Server 2005 database that contains tables employing IDENTITY Columns. Using JDev/ADF and DBSequence with an Oracle database employing before triggers/sequences accomplishes what I am

  • Photoshop CS3 wrong colors, monitor profile issue

    Hi, I have this problem, i formatted my pc, reinstalled everything, and when i started Ps, with ,me this error, showing white like purple, any suggestion? http://img379.imageshack.us/my.php?image=pscs3nz5.jpg Thanks.

  • TVARV - Integration model.

    hi we currently use TVARV entries for specifying the materials in the integration models ( to CIF to APO).  when we use a TVARV entry, we have a limitation of using only 500 entries at a times. so the number of materials in Integration Model  is rest

  • PopUp window at public wifi hotspots?

    If I connect to a public wifi hotspot I get a popup window where the landing page from the operator is shown (captive portal). How can this be managed? Because the window is closed after the login there is no chance to get the session window for logo

  • Throws statement, why exactly it is used?

    hi friends, I tried to make this thing clear to me searching a lot across internet but still not found any such article. would you please tell me why exactly we use throws statement in a method definition? however, I know this much that using this we