0

I have a code that is supposed to create an object assign it an Object ID from a static int value and then increment the static value. as shown below;

public class ObjB implements Serializable{

private static int ObjNum = 00000100; 

String OID;

public static Booking newObjBTerminal()
{    
    Booking O = new ObjB();
    String O_ID = "N" + String.valueOf(ObjB.ObjNum);
    System.out.println("Object ID is: " + O_ID);
    Booking.BkNum++;   
    O.OID = O_ID;     
}

}

I am expecting an output of

Object ID is: N00000100

Instead I get

Object ID is: N64

Any idea on whats going wrong?

EltoCode
  • 65
  • 4

0 Answers0