How to exit this method

public class Main {
   static  int i=0;
public static void main(String  args[]) {
go();
static void go(){
i++;
System.out.println("A");
if(i==10){     
   System.exit(0);  // rather than terminating the program is there a way to exit this method ??
go();
}

Assuming you mean the go method, you could use return, or just let the end of the method happen naturally.
Like for example if i is 8 then the go method exits.
You need to look into for loops, no clue what you are trying to do here, but it looks like you are trying to do a for loop without a for loop.
JSG

Similar Messages

  • How to use this method in JSTL?help me please!

    I know I can use "<C:set >" like as
    <c:set var="clabel3" value="${portalCustomizeBean.portalPage}"/> ,
    but now I want to use one method of portalCustomizeBean object not a attribute of it !!!!!
    who would tell me how to use?
    this is wrong in my code:
    <c:set var="clabel" value="${portalCustomizeBean.currentPageLabel}"/>
    <c:set var="clabel3" value="${portalCustomizeBean.toEntitiesExceptSpaceEscape(clabel)}"/>
    but how to use "toEntitiesExceptSpaceEscape" method in JSTL?????

    Why can't you just assign the method's return value to a variable and then print that? A bit of scriptlet code will do the trick. (As much as we all hate to use scriptlet code.)
    I believe you'll be able to do what you want in the 1.1 standard JSTL, but for now this will suffice. - MOD

  • How to exit from method if there is any Error message

    Hi All,
    I have one button (Retrieve) and on that button I am calling a method(OnRetrive) and in that method i am calling func module and in that i am getting some messages.
    <b>Now If that FM gives Error message then i have to exit from that method without processing further code.</b>
    How can i do this? Help!!!
    Expecting your reply ASAP.

    Use the RETURN statement. It will get out of your method.
    Regards
    Nithya

  • How to hide this method?

    I want to use Protection Proxy Pattern,but I feel nervous about my
    real method,how can i hide it(such as set it friendly or protected)?
    you can see this code:
    interface Safe{
         public String getSecret();
    class RealSafe implements Safe{
         public String getSecret(){
              return new String("You can get the secret");
    class ProtectionProxy implements Safe{
         private String password=null;
         public ProtectionProxy(String temp){
              password=temp;
         public String getSecret(){
              if(password.equals("I have the rights")){
                   RealSafe realobj=new RealSafe();
                   return realobj.getSecret();
              else{
                   return new String("Illegal password,You can't get the secret");
    How to hide the getSecret() in class RealSafe with the precondition of using Protection Proxy Pattern???????
    How can i do? i need your help,please!

    You can't prevent a malicious developer constructing an instance of RealSafe. They could always decompile your application and make changes to it if they wanted anyway!
    The ProtectionProxy is really just a convenience for users of your API. It provides "reasonable" security through a means of determining whether the current user has access to the data. It does not provide a means of determining whether the current developer has access to it!
    Your proxy lays down the rules for accessing the class being proxied. This works when the client application plays by the rules (as most applications do).
    So all you need to do is make sure that developers who play by the rules can't construct an instance of RealSafe:
    public class SafeFactory
      public static Safe getSafe(...)
        Safe safe = new RealSafe(...);
        return new ProtectionProxy(safe);
    class RealSafe implements Safe
      RealSafe(...)
    class ProtectedSafe implements Safe
      private Safe safe;
      ProtectedSafe(Safe safe)
        this.safe = safe;
    }Thus the only way for a developer to get hold of an instance of Safe is to use SafeFactory.getSafe which always returns a ProtectedSafe.
    Make sure you don't mistake this sort of pattern for robust security, though. It simply allows your client application to catch "UnauthorizedExceptions" and react accordingly. As pointed out in this thread there're various ways of getting at the data that's hiding inside a Proxy. If you're really concerned about preventing someone viewing your data unless they are authorised you need to either encrypt it or only load it (and not cache it) when their credentials have been provided.
    Hope this helps.

  • HT1414 My Iphone is in Recovery mode after upgrade to iOS 6, how to exit this mode?

    Please help on this

    same exact problem here, phone won't go out of recovery mode. went to apple store, said to restore it but will lose all of my data. don't have it backed up. read that the restore resets the phone and deletes data however it does not actually 'erase' the data. if i can get the phone restored, how do i get the data too?

  • How to use the method for field-exit to trigger the workflow?

    Dear all,
         I want the workflow to trigger , when ever the check box for DELIVERY COMPLETED is checked in ME22N .
         I have developed a method in SE18 for the corresponding field and defined function module SWE_EVENT_CREATE with BOR bus2012 and event CHANGED.
        Now how to use this method to make my workflow to trigger?Shall I create an event in delegated bus2012 and can I call this method?
    Thanks and regards,
    S.Suresh

    Hi
    You want to place your method which is defined for particular filed.right?
    For that you can go for BADI. First you check whether any badi is getting called form that tcode ME22N. Then to place your method, implement that BADI.  So whenever that BADI is getting called, it will call your event. Through Event workflow will be getting triggered.
    Regards,
    Hemalatha.

  • SetDataValueAt() ? How do i use this method ?

    Hello,
    I have a application that was made using jdeveloper and
    bc4j,and in it I want to update a jjtextfield that is bound to a view object.I've read up on jutextfieldbinding and it has a method setDataValueAt(java.lang.Object,int attrindx) that I think i need.
    Please show me how to use this method as I can't find examples anywhere.I am new to programming with BC4j.
    Thanks in advance,
    Carl Lang

    For textfields bindings, you may use
    setDataValueAt(yournewvalue, 0)

  • How to call a method in private section of a class in the public section

    Hi Everybody,
    i have written a method(meth1) in the private section of a class(C1).
    it is as follows
    class C1 definition.
    private section.
    methods: meth1 importing im_dt1 like tp1
                                             im_dt2 like tp2
                                             im_dt3 like tp3
                                             im_dt4 like tp4
                               returning value(re_dt1) like tp5.
    endclass.
    i have the final data that has to be displayed in internal table re_dt1.
    now my question is how to call  this method present in private section into public section and display the data present in re_dt1.
    Thanks,
    learning.abap.

    Hi,
    what you need is one public method being called at start-of-selection. Within this the private methods have to be called.
    The question is, why has the method for reading the database tables to be private? If you have only one private method reading all database tables the public method being called at start-of-selection will only consist of a call-method statement.
    This seems to be one call to much.
    The logic for reading the different database tables is hidden inside the class anyway.
    Is there any further logic reading the different database tables?
    Have always all table to be read? If not another approach would be one private method for each database table being called by a public method deciding which table has to be read:
    public section.
    methods get_data returning value(re_Dt1).
    private section.
    methods:
    get_table_a returning value(im_dt1),
    get_table_b returning value(im_dt2),
    get_table_c returning value(im_dt3),
    get_table_d returning value(im_dt4),
    combine_data importing im_dt1
                                    im_dt2
                                    im_dt3
                                    im_dt4
                            returning value(re_dt1).
    *- implementation of public method:
    method get_data.
      data: lt_dt1 ...
               lt_dt2,
               lt_dt3,
               lt_dt4.
    * here decide which tables have to be read:
    lt_dt1 = get_table_a( ).
    lt_dt2 = get_table_b( ).
    lt_dt3 = get_table_c( ).
    lt_dt4 = get_table_d( ).
    re_dt1 = combine_data( i_dt1 = lt_dt1
                                           i_dt2 = lt_dt2
                                           i_dt3 = lt_dt3
                                           i_dt4 = lt_dt4 ).
    endmethod.
    *- implementation of private methods
    method get_table_a.
    endmethod.
    method get_table_b.
    endmethod.
    method get_table_c.
    endmethod.
    method get_table_d.
    endmethod.
    method combine_data.
    endmethod.
    Regards
    Dirk

  • Interface/Method question (how to use the method insert_table)

    Hi people!
    I'm working with DOI (desktop office integration).
    So far I've been able to reflect flat variables from my ABAP program into a Word Doc, but when it comes to internal tables I'm not sure how to achieve this.....
    I find out in the interface i_oi_word_processor_document the method insert_table, but I can't find a single simple example on how to use it....
    If no one knows how to use this method, does anyone know how to reflect an internal table fron my program into a Word Doc by another mean?
    Thanks in advance!!!
    Regards,
    Laura

    Hi Laura
    If you want you can use direct OLE calls. For this, you can refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c1d54348-0601-0010-3e98-bd2a2dcd9e6c">"An Easy Reference For OLE Automation"</a> published at SDN.
    Kind Regards
    *--Serdar
    [email protected]

  • How to use  Aggregations Method generated by WIZARD

    Hi All,
              I used ABAP wizard to develop I report.
    This wizard generated one class and method as below
      zcl_bt_alv_template=>factory(
                     exporting  im_syrepid = sy-repid
                                im_lheader = gv_title
                                im_allowls = abap_true  " Allow layout save
                     importing  ex_alvo    = r_alv_template
                     changing   ch_datatab = it_efficiency ).
    Inside this Factory Method there is one method for aggregations.
      ex_alvo->r_aggregations = ex_alvo->r_table->get_aggregations( ).
    How to use this Method for getting aggregations for some fields.
    Thanks,
    Prasad.

    Hi Patel,
                   I am getting DUMP for this.
    Its saying Access via 'NULL' object reference not possible.
    Patel when I am double clicking the 
    aggregation = if_salv_c_aggregation=>total
    This if_salv_c_aggregation is not having any methods.
    So may be the dump is coming.
    The dump is
    You attempted to use a 'NULL' object reference (points to 'nothing')
    access a component (variable: "R_AGGREGATIONS").
    Thanks,
    Prasad.
    Edited by: Dheeru Prasad on Aug 6, 2009 3:36 PM
    Edited by: Dheeru Prasad on Aug 6, 2009 3:39 PM
    Edited by: Dheeru Prasad on Aug 6, 2009 3:40 PM

  • How to exit zenmicro recovery mo

    Help! My zen microphoto was working just fine this afternoon, but when I got home and turned it on I found it in 'recovery mode' and I don't know how to exit this. I tried clean up and reboot, but neither made any difference. What should I do?

    It sounds like it's stuck in Recovery Mode then. Connect the player to your PC, and see if it's picked up. If it is, you can try loading the firmware update (available on the Downloads page).
    Cat

  • How to use two split this method in my code

    How to use two split this method in my code
    if i got one string line which like this
    ("aa!bb!cc~ab!bc!cd") a
    nd want to use two split to spare ! and ~ this seal for my spare point how that output
    has come diff ?
    public static void main(String[] args) {
        String str = "aa!bb!cc~ab!bc!cd";
        String strs[]= str.split("~");
        String strE[]= str.split("!");
        int count =0;
        for(int j=0; j < strs.length; j++){
          for (int i = 0; i < strE.length; i++){   
              System.out.println(count + " " + strE);
    count++;
    the output how can it be like this
    0 aa
    0 bb
    0 cc
    1 ab
    1 bc
    1 cd

    Move your second slit inside the first loop, so you are splitting the substring, not the entire string.

  • I plug my iPhone 3gs into my laptop and it no longer syncs with my iTunes.  Ive tried all the trouble shooting methods and nothing works.  My iPhone doesnt appear on iTunes or under "my computer." Does anyone know how to fix this?

    I plug my iphone 3gs into my laptop and it no longer syncs with my iTunes.  I've tried all the trouble shooting methods and nothing works.  My iPhone doesn't appear on iTunes or under "My Computer." Does anyone know how to fix this?

    If AMDS is running, you are using a USB port directly on the computer and not a hub, you have disconnected other USB devices except keyboard and mouse, you have completely uninstalled and reinstalled iTunes as described in http://support.apple.com/kb/HT1925, You have tried cleaning the connector on the bottom of the phone, you have tried a different cable, you have installed the latest USB drivers for your computer, you have disabled your antivirus and firewall, you are running as an Administrator account and you have tried creating a new user on your computer and connected when logged in as that user then you have exhausted my knowledge. The only other thing to try is a different computer. If it isn't recognized on a different computer you have a hardware problem. Good luck!

  • How can i get a file header using this method cl_gui_frontend_services= gui

    Hi Experts,
    How can i get a file header using this method cl_gui_frontend_services=>gui_download
    Thanks
    Basu

    Hi,
    You can use the FM - GUI_DOWNLOAD to specify the headers. It can be done in the following manner -
    TYPES: BEGIN OF ty_head, "Structure for header
                 h(10) TYPE c,
                 END OF ty_head.
    DATA: it_head  TYPE TABLE OF ty_head WITH HEADER LINE.
    "Adding header details
    it_head-h = 'Field1'.
    APPEND it_head.
    it_head-h = 'Field2'.
    APPEND it_head.
    it_head-h = 'Field3'.
    APPEND it_head.
    it_head-h = 'Field4'.
    APPEND it_head.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = p_file
       filetype                        = 'ASC'
       write_field_separator           = 'X'
       header                          = '00'  "<= note this
      TABLES
        data_tab                        = it_tab
       fieldnames                      = it_head[] "<= Pass your header table here
    EXCEPTIONS
       OTHERS                          = 1.
    Hope this helps.
    Regards,
    Himanshu

  • HT201303 last time i bought apps by using visa gift card so iam trying to use the kind of visa gift card and the system is denying the method payment ....any idea how to solve this with my itune account ?

    last time i bought apps by using visa gift card so iam trying to use the kind of visa gift card and the system is denying the method payment ....any idea how to solve this with my itune account ?

    A few reasons I can think of, but instead of shooting in the dark, lets check with experts who can look at your account.
    iTunes Store Support
    http://www.apple.com/emea/support/itunes/contact.html

Maybe you are looking for

  • TRIAL VERSIONS - How many times can we get one?

    Good evening, I kindly ask you help in this matter as I need urgently to have a new trial version of Acrobat Pro in order to finish an important document. I had a trial version that expired. Mine questions are; - can I have a new trial?with the same

  • Vmrc.exe command line password option?

    Does VMRC 7.0 have an option to enter the password from command line? I can only find a way to enter the username. The password is prompted during connection. I would like to find a way to script this command .

  • What is safety delta time

    Hi Experts Can any one please explain me What is safety delta time in terms of delta data source Thanks

  • Aperture won't import .bmp files

    I just set up Aperture (v. 1.5.4), and imported from iPhoto Library. All the .jpegs and .tiffs transferred over, but the .bmp files didn't. I tried to manually import them, but when I selected the folder they're in for import, the .bmp files didn't e

  • Essbase doesnt start after DST patch

    Dear Friends -<BR><BR>We are using Essbase server version 7.1.5.<BR>Recently we applied the DST (Daylight saving) patch on our Essbase server and operating system (Unix AIX) and after that we are unable to start Essbase on our servers.<BR><BR>The mes