What is happening in this code

Hello guys
import java.util.*;
public class nip{
     public static void main(String args[]){
          Random rn=new Random();
          int array1[]=new int[7];
          for(int counter=1;counter<50;counter++){
               ++array1[1+rn.nextInt(3)];
for(int face=1;face<array1.length;face++){
          System.out.println(array1[face]);
System.out.println(1+rn.nextInt(6));
     }}its give me random 3 digit numbers
How it's works
Thank you guys

Sorry guys
It's like this
import java.util.*;
public class nip{
     public static void main(String args[]){
          Random rn=new Random();
          int array1[]=new int[7];
          for(int counter=1;counter<1000;counter++){
               ++array1[1+rn.nextInt(6)];
for(int face=1;face<array1.length;face++){
          System.out.println(array1[face]);
i didn't understand
          for(int counter=1;counter<1000;counter++){
               ++array1[1+rn.nextInt(6)];
     }what happen i this part

Similar Messages

  • What will happen in this code.

    Hi all,
    Im trying to understand the execution path when an exception is raised. In this example, what will happen when testExcep is raised.
    1. Will the rollback take place?
    or
    2: Control will be passed to the calling procedure and thus nothing in the "WHEN OTHERS" clause will be executed.
    I thought that when in testExcep, the code will raise an exception which will be passed to the "When Others" clause. Someone please clarify this to me.
    Thanks
    WHEN testExcep
    THEN
    RAISE;
    WHEN OTHERS
    THEN
       ROLLBACK;
       write_batch_job_log('Oracle error: '||SQLERRM,
                           'Calc Inv Counts',
                           'F',
                           lv_start_date);
       COMMIT;
       RAISE;
    END calc_inv_qtr_counts;

    The Best this is to try it for yourself.
    This is how you can..
    Declare
    PROCEDURE my_test is
    textExcep Exception ;
    Begin
    DBMS_OUTPUT.PUT_LINE( 'In my test Proc Body') ;
    Raise textExcep ;
    Exception
    WHEN textExcep
    THEN
    DBMS_OUTPUT.PUT_LINE( 'passing call back to calling program') ;
    RAISE;
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE( 'Rolled back') ;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE( 'Commit') ;
    RAISE;
    END;
    Begin
    my_test ;
    Exception
    When Others Then
    DBMS_OUTPUT.PUT_LINE( 'Main Block Error handler') ;
    End ;
    Declare
    PROCEDURE my_test is
    textExcep Exception ;
    Begin
    DBMS_OUTPUT.PUT_LINE( 'In my test Proc Body') ;
    Raise NO_DATA_FOUND;
    Exception
    WHEN textExcep
    THEN
    DBMS_OUTPUT.PUT_LINE( 'passing call back to calling program') ;
    RAISE;
    WHEN OTHERS
    THEN
    ROLLBACK;
    DBMS_OUTPUT.PUT_LINE( 'Rolled back') ;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE( 'Commit') ;
    RAISE;
    END;
    Begin
    my_test ;
    Exception
    When Others Then
    DBMS_OUTPUT.PUT_LINE( 'Main Block Error handler') ;
    End ;
    /

  • What will happen with the code?

    What will happen with the code below?
    for (i=0; i<=10000; i++)
    Object[] obj = new Object[5];
    In every loop, a new Array of Object wll be created. Will the Array of Object created in the
    current loop( for example, i=2001), eliminate the Array of Object created in previous loop
    (for example, i=2000 or 1999)? How the memory is allocated in every loop?
    Thanks.

    Each time through the loop, an array of five Object references is created. A reference to this array is assigned to the reference variable obj, causing the previously allocated array to be unreachable (except the first time through the loop, if obj was originally null). The garbage collector will collect these unreachable arrays if the memory gets low.

  • What is wrong with this code? on(release) gotoAndPlay("2")'{'

    Please could someone tell me what is wrong with this code - on(release)
    gotoAndPlay("2")'{'
    this is the error that comes up and i have tried changing it but it is not working
    **Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 2: '{' expected
         gotoAndPlay("2")'{'
    Total ActionScript Errors: 1 Reported Errors: 1
    Thanks

    If you have a frame labelled "2" then it should be:
    on (release) {
        this._parent.gotoAndPlay("2");
    or other wise just the following to go to frame 2:
    on (release) {
         this._parent.gotoAndPlay(2);
    You just had a missing curly bracket...

  • What is happening in this plan

    Hi Please take a look at the below query and its plan. The Step 9 in the Plan applies the condition (ebill.is_synced_to_orig = 0 OR ebill.is_synced_to_orig IS NULL). but since it is a index scan it only applies is_synced_to_orig = 0 condition. But ideally the other selectivity should also be considered somewhere else right. but I could not see that in the plan.
    Is oracle skipping that condition?? much appreciate if someone can say what is happening in this plan for is_synced_to_orig IS NULL condition. thanks...
    SELECT ebill.ebill_summary_id
    FROM ebill_summary ebill INNER JOIN originator orig
    ON ebill.originator_id = orig.originator_id
    AND (ebill.is_synced_to_orig = 0 OR ebill.is_synced_to_orig IS NULL)
    INNER JOIN entity e
    ON e.entity_id = orig.entity_id
    AND e.entity_type_id = 1
    AND e.entity_id = 1
    LEFT OUTER JOIN te_pmt_task_lock tl
    ON tl.payment_request_id = ebill.ebill_summary_id
    AND tl.te_task_id = 1234
    AND tl.is_expired = 1
    WHERE tl.payment_request_id IS NULL AND ROWNUM <= 1000;
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 56 | 16 (0)| 00:00:01 |
    |* 1 | COUNT STOPKEY | | | | | |
    |* 2 | FILTER | | | | | |
    | 3 | NESTED LOOPS OUTER | | 1 | 56 | 16 (0)| 00:00:01 |
    | 4 | NESTED LOOPS | | 1 | 47 | 2 (0)| 00:00:01 |
    | 5 | NESTED LOOPS | | 1 | 43 | 1 (0)| 00:00:01 |
    |* 6 | TABLE ACCESS BY INDEX ROWID| ENTITY | 1 | 4 | 1 (0)| 00:00:01 |
    |* 7 | INDEX UNIQUE SCAN | ENTITIES_PK | 1 | | 0 (0)| 00:00:01 |
    | 8 | TABLE ACCESS BY INDEX ROWID| EBILL_SUMMARY | 1 | 39 | 0 (0)| 00:00:01 |
    |* 9 | INDEX RANGE SCAN | EBILL_IS_SYNCED_TO_ORIG_IDX | 1 | | 0 (0)| 00:00:01 |
    |* 10 | TABLE ACCESS BY INDEX ROWID | ORIGINATOR | 1 | 4 | 1 (0)| 00:00:01 |
    |* 11 | INDEX RANGE SCAN | ORIGINATOR_ENTITY_IDX | 1 | | 0 (0)| 00:00:01 |
    |* 12 | INDEX RANGE SCAN | TEPMTTSKLCK_TSKEXPRDPYNREQ_ID | 1 | 9 | 14 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(ROWNUM<=1000)
    2 - filter("TL"."PAYMENT_REQUEST_ID" IS NULL)
    6 - filter("E"."ENTITY_TYPE_ID"=1)
    7 - access("E"."ENTITY_ID"=1)
    9 - access("EBILL"."IS_SYNCED_TO_ORIG"=0)
    10 - filter("EBILL"."ORIGINATOR_ID"="ORIG"."ORIGINATOR_ID")
    11 - access("ORIG"."ENTITY_ID"=1)
    12 - access("TL"."TE_TASK_ID"(+)=1234 AND "TL"."IS_EXPIRED"(+)=1 AND
    "TL"."PAYMENT_REQUEST_ID"(+)="EBILL"."EBILL_SUMMARY_ID")

    Well, if the column is declared as NOT NULL and you ask for all rows such that the column = 1 OR it is null then really you are asking for all data where the column = 1 since by definition, there cannot be nulls (the NOT NULL constraint on the column prohibits NULL data from occurring).
    Make sense?
    Now, i'm not saying that's what your issue is, but since i haven't seen what your tables look like ... it's as good a guess as i can muster.

  • I can't figure out what's wrong with this code

    First i want this program to allow me to enter a number with the EasyReader class and depending on the number entered it will show that specific line of this peom:
    One two buckle your shoe
    Three four shut the door
    Five six pick up sticks
    Seven eight lay them straight
    Nine ten this is the end.
    The error message i got was an illegal start of expression. I can't figure out why it is giving me this error because i have if (n = 1) || (n = 2) statements. My code is:
    public class PoemSeventeen
    public static void main(String[] args)
    EasyReader console = new EasyReader();
    System.out.println("Enter a number for the poem (0 to quit): ");
    int n = console.readInt();
    if (n = 1) || (n = 2)
    System.out.println("One, two, buckle your shoe");
    else if (n = 3) || (n = 4)
    System.out.println("Three, four, shut the door");
    else if (n = 5) || (n = 6)
    System.out.println("Five, six, pick up sticks");
    else if (n = 7) || (n = 8)
    System.out.println("Seven, eight, lay them straight");
    else if (n = 9) || (n = 10)
    System.out.println("Nine, ten, this is the end");
    else if (n = 0)
    System.out.println("You may exit now");
    else
    System.out.println("Put in a number between 0 and 10");
    I messed around with a few other thing because i had some weird errors before but now i have narrowed it down to just this 1 error.
    The EasyReader class code:
    // package com.skylit.io;
    import java.io.*;
    * @author Gary Litvin
    * @version 1.2, 5/30/02
    * Written as part of
    * <i>Java Methods: An Introduction to Object-Oriented Programming</i>
    * (Skylight Publishing 2001, ISBN 0-9654853-7-4)
    * and
    * <i>Java Methods AB: Data Structures</i>
    * (Skylight Publishing 2003, ISBN 0-9654853-1-5)
    * EasyReader provides simple methods for reading the console and
    * for opening and reading text files. All exceptions are handled
    * inside the class and are hidden from the user.
    * <xmp>
    * Example:
    * =======
    * EasyReader console = new EasyReader();
    * System.out.print("Enter input file name: ");
    * String fileName = console.readLine();
    * EasyReader inFile = new EasyReader(fileName);
    * if (inFile.bad())
    * System.err.println("Can't open " + fileName);
    * System.exit(1);
    * String firstLine = inFile.readLine();
    * if (!inFile.eof()) // or: if (firstLine != null)
    * System.out.println("The first line is : " + firstLine);
    * System.out.print("Enter the maximum number of integers to read: ");
    * int maxCount = console.readInt();
    * int k, count = 0;
    * while (count < maxCount && !inFile.eof())
    * k = inFile.readInt();
    * if (!inFile.eof())
    * // process or store this number
    * count++;
    * inFile.close(); // optional
    * System.out.println(count + " numbers read");
    * </xmp>
    public class EasyReader
    protected String myFileName;
    protected BufferedReader myInFile;
    protected int myErrorFlags = 0;
    protected static final int OPENERROR = 0x0001;
    protected static final int CLOSEERROR = 0x0002;
    protected static final int READERROR = 0x0004;
    protected static final int EOF = 0x0100;
    * Constructor. Prepares console (System.in) for reading
    public EasyReader()
    myFileName = null;
    myErrorFlags = 0;
    myInFile = new BufferedReader(
    new InputStreamReader(System.in), 128);
    * Constructor. opens a file for reading
    * @param fileName the name or pathname of the file
    public EasyReader(String fileName)
    myFileName = fileName;
    myErrorFlags = 0;
    try
    myInFile = new BufferedReader(new FileReader(fileName), 1024);
    catch (FileNotFoundException e)
    myErrorFlags |= OPENERROR;
    myFileName = null;
    * Closes the file
    public void close()
    if (myFileName == null)
    return;
    try
    myInFile.close();
    catch (IOException e)
    System.err.println("Error closing " + myFileName + "\n");
    myErrorFlags |= CLOSEERROR;
    * Checks the status of the file
    * @return true if en error occurred opening or reading the file,
    * false otherwise
    public boolean bad()
    return myErrorFlags != 0;
    * Checks the EOF status of the file
    * @return true if EOF was encountered in the previous read
    * operation, false otherwise
    public boolean eof()
    return (myErrorFlags & EOF) != 0;
    private boolean ready() throws IOException
    return myFileName == null || myInFile.ready();
    * Reads the next character from a file (any character including
    * a space or a newline character).
    * @return character read or <code>null</code> character
    * (Unicode 0) if trying to read beyond the EOF
    public char readChar()
    char ch = '\u0000';
    try
    if (ready())
    ch = (char)myInFile.read();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (ch == '\u0000')
    myErrorFlags |= EOF;
    return ch;
    * Reads from the current position in the file up to and including
    * the next newline character. The newline character is thrown away
    * @return the read string (excluding the newline character) or
    * null if trying to read beyond the EOF
    public String readLine()
    String s = null;
    try
    s = myInFile.readLine();
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    if (s == null)
    myErrorFlags |= EOF;
    return s;
    * Skips whitespace and reads the next word (a string of consecutive
    * non-whitespace characters (up to but excluding the next space,
    * newline, etc.)
    * @return the read string or null if trying to read beyond the EOF
    public String readWord()
    StringBuffer buffer = new StringBuffer(128);
    char ch = ' ';
    int count = 0;
    String s = null;
    try
    while (ready() && Character.isWhitespace(ch))
    ch = (char)myInFile.read();
    while (ready() && !Character.isWhitespace(ch))
    count++;
    buffer.append(ch);
    myInFile.mark(1);
    ch = (char)myInFile.read();
    if (count > 0)
    myInFile.reset();
    s = buffer.toString();
    else
    myErrorFlags |= EOF;
    catch (IOException e)
    if (myFileName != null)
    System.err.println("Error reading " + myFileName + "\n");
    myErrorFlags |= READERROR;
    return s;
    * Reads the next integer (without validating its format)
    * @return the integer read or 0 if trying to read beyond the EOF
    public int readInt()
    String s = readWord();
    if (s != null)
    return Integer.parseInt(s);
    else
    return 0;
    * Reads the next double (without validating its format)
    * @return the number read or 0 if trying to read beyond the EOF
    public double readDouble()
    String s = readWord();
    if (s != null)
    return Double.parseDouble(s);
    // in Java 1, use: return Double.valueOf(s).doubleValue();
    else
    return 0.0;
    Can anybody please tell me what's wrong with this code? Thanks

    String[] message = {
        "One, two, buckle your shoe",
        "One, two, buckle your shoe",
        "Three, four, shut the door",
        "Three, four, shut the door",
        "Five, six, pick up sticks",
        "Five, six, pick up sticks",
        "Seven, eight, lay them straight",
        "Seven, eight, lay them straight",
        "Nine, ten, this is the end",
        "Nine, ten, this is the end"
    if(n>0)
        System.out.println(message[n]);
    else
        System.exit(0);

  • TS1702 Any body know what is happening with this app "eTodo" ? is no more in the iTunes store !

    Any body know what is happening with this app "eTodo" ? is no more in the iTunes store !
    I have this problem for one year I think and no one can’t solve that,I made 6 screen shots and I will uploading in a few seconds all of them and please just check them !
    My problem is: I bought an application last year and after some time I had lost the app from my iTunes store.
    Now,what I want to do is: I want to get that app again,but I could not find anywhere in the iTunes  store,websites ,nobody could not help me with that
    The app has been deleted from everywhere !

    If the app is no longer in the store then you won't be able to redownload it. You don't have a copy of it in your computer's iTunes library or on your backup of your downloads/library so that you can sync it back to your phone ?

  • What is wrong in this code..please

    first of all,i kindly request team please not kill me by giving suggestion using xml parser.......can u please tell how this handle in reading follwing lines....
    orderREF="1036578"><edm:OrderItem><edm:Order orderID="1036579"/> ineed to retoeve value 1036578 i use following code
    final String START6_TAG="orderREF=";
    final String END6_TAG=">";
    final String END7_TAG="/>";
    as per my observation,the follwing code need not work
    if(line.indexOf(START6_TAG)> -1 ) {
    //this code handle "orderREF=" in stands for order id
    if(line.indexOf(END7_TAG,line.indexOf(START6_TAG))>-1){ //because if we use line.indexOf(END7_TAG)it take only first indexof that..
    efound9=false;
    asper above line this code cannot excecute.but igo to loop and set flag efound9=false, what is wrong in this code for handling
    orderREF="1036578"/><edm:OrderItem><edm:Order orderID="1036579"/> this type of line that also comes in same program,here also we need output as 1036578.please tell me what i will do to hanndle these

    first of all,i kindly request team please not kill
    me by giving suggestion using xml parser.......can u
    please tell how this handle in reading follwing
    lines.... I don't understand why you are so opposed to an xml parser. You could have spent 3 hours learning how to use it and been done with this problem in the time you've spent trying to hack your way around it.
    jdom tutorials: http://www.jdom.org/downloads/docs.html
    dom4j tutorials: http://www.dom4j.org/cookbook.html

  • What's wrong in this code?

    Hi,
    I'm using the following code when the user reaches the last
    row in the jtable.In this code i'm calling database and setting
    glasspane to block user input.Here i need to set message like
    "[PAGE] next ...." using JLabel which is not showing.
    What is the reason the message is not showing up?
    ArrayList getData(final int id,final int dir,final String where){
    final String msg =(dir == REVERSE_LT)?"[PAGE] PREVIOUS .... ":"[PAGE] NEXT .... ";
    //cat.info(" msg @ getData "+msg);
    //cat.info(" isEventDipatchThread "+ SwingUtilities.isEventDispatchThread () );
    display.msgLbl.setText(msg);
    cat.info(" msg @ getText() "+display.msgLbl.getText());
    display.glassPane.setVisible(true);
    SwingWorker worker = new SwingWorker() {
         ArrayList al = new ArrayList();
         public Object construct() {
         try{
         return getDataT(id,dir,where);
         catch(Exception ex){
         cat.error(ex.toString());
         SwingUtilities.invokeLater(new Runnable() {
         public void run() {
                   display.setMessage (msg+" failed");
         finally{
         SwingUtilities.invokeLater(new Runnable() {
              public void run() {
              cat.info(" setting glass pane false ");
              display.glassPane.setVisible(false);
         return al;
    public void finished() {
         SwingUtilities.invokeLater(new Runnable() {
         public void run() {
              cat.info(" setting message empty ");
              display.setMessage (" ");
    worker.start();
    //display.setMessage(msg);
    return (ArrayList)worker.get();
    Any help will be appreciated.
    best regards,
    mohan

    it doesn't need an instance of MyOuter to initiate the MyInner objectAnd - as you've found - to supply an instance of MyOuter is just wrong.
    [This thread|http://forums.sun.com/thread.jspa?threadID=765356&tstart=18239] discusses the terminology that's used in Java: classes being static/top-level/inner/nested and class instance creation expressions being qualified/unqualified. There are references to the JLS.
    Briefly put, MyInner is not an inner class: it's a nested one. And the error occurs because you are attempting to create an instance of a non-inner class with a qualified class instance creation expression.

  • Empty field Validation before Print, What's Wrong with THIS code??

    I have been trying unsuccessfully to get this code to work.. I am stumped!  I created a print button.  Then added this script under "Form Calc" in the Click event of the button.  But when clicked nothing happens.  I have a radio button group that has different options but I only want to make the field NameofReferralSource required if the user checks Broker.  The print button is on page 1.  The field and radio button group are on page 7.  I just can't figure out how to get this to work.  I don't necessarily need to make the fields required since then I would have to add script remove the red border and add a message telling user where the field is otherwise they will have to search through 6 pages to find it. (maybe a better solution?)  I just want a simple code that fires when the user hits the Print, Save, or Submit button to check if Broker name is empty and if it is, prompt them to fill in.  Help!
    if ((topmostSubform.Page7.NameofReferralSource.rawValue == null)  & (topmostSubform.Page7.Howdidyouhear.0.rawValue == "Broker")) then
    xfa.host.messageBox("You must enter the the Name of the Broker under Referral Name on Page 7 to be able to print this form")
    else
    Print_Form.execEvent("click")
    endif
    Brenda

    Ok, well my reference to the fields were incorrect.  Here is the new code:
    if (Page7.NameofReferralSource.rawValue == null){
    xfa.host.messageBox("You must enter the the Name of your Referral on the bottom of Page 7 to be able to print this form");
    }else{
    Print_Form.execEvent("click");
    xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);
    The first part that checks for an empty field and displays a message works however the print dialog still pops up after the user clicks ok to the error message.  Any ideas?

  • What will happen after this?

    I have a procedure kicked off yesterday to update a table. But I killed it this morning. Just after I killed the session, I kicked off another SQL to perform the same task to update the same table and same columns but faster.
    What is happening right now is: the Oracle is performing a roll back on the killed procedure while the new SQL is running.
    So here are my questions:
    1. what will happen later when the SQL is completed and the roll back is not done yet?
    2. Will the roll back affect the new SQL updates?
    Thanks,
    Edited by: user644467 on Mar 11, 2011 9:37 AM

    Dive into the concepts manual. A basic concept of Oracle [url http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/consist.htm#CNCPT020]concurrency and consistency is that each (something) gets a view of the database at the start of the (something). (something) is usually a transaction or statement, depending on configuration and programming. Oracle uses System Change Numbers to figure out if each view should include any particular version of block data, kind of like a clock.
    So basically, it all works, but you may see performance impacts just because stuff is happening, and you may see odd effects if you don't understand what you are doing. It is different than other database engines.

  • What is happening in the code

    What is happening here:
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    I use it and it works fine but I have no idea what is going on there?

    Class.forName() loads the given class. In itself, that isn't interesting. The beef lies in that loading a class executes any static blocks in that class.
    If you had the source to com.mysql.jdbc.Driver, it would probably start something like:
    public class Driver
        static {
            Driver driver_object = new Driver();
            java.sql.DriverManager.registerDriver(driver_object);
    }The static block does the actual work of registering the driver. Class.forName() is really just a bit of a hack to get that static block executed.
    The newInstance() call is customary because there is an old rumor that some buggy JDBC driver somewhere is missing the static block, and has the registerDriver() call in a Driver() object constructor instead. A belt and suspenders kind of thing.

  • What's wrong with this code (in recursion there may be a problem )

    // ELEMENTS OF TWO VECTORS ARE COMPARED HERE
    // CHECK WHAT IS WRONG WITH THIS PGM
    // there may be a problem in recursion
    import java.util.*;
    class Test
    Vector phy,db;
    public static void main(String adf[])
         Vector pp1=new Vector();
         Vector dp1=new Vector();
         //adding elements to the vector
         pp1.add("1");
         pp1.add("a");
         pp1.add("b");
         pp1.add("h");
         pp1.add("c");
         dp1.add("q");
         dp1.add("c");
         dp1.add("h");
         dp1.add("w");
         dp1.add("t");
         printVector(dp1);
         printVector(pp1);
         check2Vectors(pp1,dp1);
    public static void printVector(Vector v1)
         System.out.println("Vector size "+v1.size());
         for(int i=0;i<v1.size();i++)
              System.out.println(v1.get(i).toString());
    public static void check2Vectors(Vector p,Vector d)
         System.out.println("p.size() "+p.size()+" d.size() "+d.size());
         printVector(p);
         printVector(d);
         for(int i=0;i<p.size();i++)
                   for(int j=0;j<d.size();j++)
                        System.out.println(" i= "+i+" j= "+j);
                        Object s1=p.elementAt(i);
                        Object s2=d.elementAt(j);
              System.out.println("Checking "+s1+" and "+s2);
                        if(s1.equals(s2))
    System.out.println("Equal and Removing "+s1+" and "+s2);
                             p.remove(i);
                             d.remove(j);
                             printVector(p);
                             printVector(d);                    
                        check2Vectors(p,d);
                   }//inner for
              }//outer for     
    if(p.size()==0||d.size()==0)
    System.out.println("Vector checking finished and both match");
    else
    System.out.println("Vector checking finished and both do not match");
    }//method
    }

    hi,
    but the upper limit is changing everytime you call the function recursively
    so there should not be any problem(i suppose)
    my intension is to get the unmatched elements of the two vectors
    suggest me changes and thanks in advancce
    ashok
    The problems comes from the fact that you remove
    elements for a Vector while iterating in a loop where
    the upper limit as been set to the initial size of the
    Vector.
    You should use so while loops with flexible stop
    conditions that would work when the size of the Vector
    changes.
    Finally: why don't you use Vector.equals() ?

  • What would happen if this runs?

    This is a 'real' code example that i found in this program. Could this cause connection pools to not be relased
    Connection con = null;
    stmt = con.createStatement();
    int ret = stmt.executeUpdate(simple query);
    con.commit();
    con.rollback();
    con.commit();
    con.close

    Connection con = null;
    stmt = con.createStatement();You will get a NullPointerException here. :P
    If we assume that you are getting a Connection from a DataSource...
    int ret = stmt.executeUpdate(simple query);
    con.commit();This should commit the updates (even if the auto-commit mode is set to false). It releases all the previous savepoints as well.
    con.rollback();This won't have any effect.
    con.commit();Neither would this.
    con.close();If all this code is in one block, there is no guarantee that the connection will be closed. This should be in a finally block preferably. :)

  • Connected to Internet or not connected? what is wrong with this code?

    hi
    here is a simple code to check whether Internet is connected to my machine or not----------
    import java.net.*;
    class CheckNet
         public static void main(String args[])
              while(true)
                   check();
                   try{
                   Thread.sleep(1000);
                   }catch(InterruptedException ie){System.out.println(ie);}
         static void check()
              try
                             String hostAddress ;
                             InetAddress localHost ;
                                  localHost = InetAddress.getLocalHost();
                                  hostAddress = localHost.getHostAddress();
                                  if (hostAddress.equals( "127.0.0.1" ))
                                  System.out.println("Not connected");
                                  else
                                  System.out.println("Connect to host: " + hostAddress);
                        catch(UnknownHostException ukhe){System.out.println(ukhe);}
    this code tells the status of connection at first call of method check() in code, but can not update itself i.e if status of net conn is changed prog continues to output the same result.
    CAN ANYBODY HELP ME TO REMOVE THE BUG / or suggest a better way?
    regards

    I've run into the same issue and found the following:
    InetAddress caches successful and unsuccessful host name resolutions (See JavaDocs for InetAddress for more detail on this).
    My guess is that InetAddress has cached the unsuccessful attempt and therefore when a network connection is established in your application loop, InetAddress "thinks" its still not connected.
    The JavaDocs say something about setting a security property which can control the cache time, but I haven't been able to get InetAddress to recognize the property change. I'm probably not setting it in the right place.
    HTH,
    robert

Maybe you are looking for

  • HP Photosmart C7280 All-in-one problem printing. Ink System Failure has failed unable to copy--

    I'm having a problem printing on my HP Photosmart C7280 All-In-One. The following message is what came up on the printer screen: Ink System Failure has failed unable to copy, receive faxes or print. Refer to printer documentation Error O.cl9a0007. Do

  • Where to find number of concurrent users in 10g OEM

    I have recelntly installed an instance in oracle 10g release2 rdbms.Is this possible to find the number of concurrent users in OEM.If yes please show me the steps.

  • Stored Procedure error with JDBC:ODBC

    Hi, I am trying to run a stored procedure on RDMS (Uniaccess ODBC). This has 2 input parameters and returns a resultset of 3 columns. The following is the error I am getting and am stumped. Please help.. (similar call statement works with VB and ADO)

  • MacMini to iMac 27" Display

    Can I connect an older Mac Mini (approx 2007) to a new iMac 27" display - I am about to purchase one but in doing so will be removing the PC/LCD monitor... So what options do I have or is this a non-starter?

  • Managed System Configuration

    Dear Team, While doing managed system configuration for AS JAVA system (only used for BI JAVA) we are getting error as "Solman System prerequisite are not met" ST-A/PI 01P_700 is not installed. When Checked in Solman system ; However the ST-A/PI is h