Re: Need some help please

From: George Birbilis [MVP J#] [9880] (birbilis_at_kagi.com)
Date: 02/12/05

  • Next message: George Birbilis [MVP J#] [9880]: "Re: System.Windows.Forms.UserControl as JPanel parent?"
    Date: Sat, 12 Feb 2005 22:42:05 +0200
    
    

    > 1. convert between data types

    //convert integer to string
    int x=0;
    String s=String.valueOf(x);

    > 2. use an array

    //init an array with numbers 0-9
    int a[10];
    for(int i=0;i<10;i++) {
     a[i]=i;
    }

    > 3. use a vector

    //create a Vector and add integer values 0 and 1 to it (as instances of
    Integer class)
    java.util.Vector v=new java.util.Vector();
    v.add(new Integer(0));
    v.add(new Integer(1));

    > 4. use a loop

    see case [2] above

    > 5. use branching statement

    int x=1;
    if (x!=0) {
     System.out.println("value is "+x);
     //if the above line doesn't compile try "value is "+String.valueOf(x)
    instead
    } else {
     System.out.prinltn("value is zero");
    }

    to make all these into a program do something like

    public static void main(String[] args){
     //...put your code here, using "System.out.prinltn(...)" wherever you need
    to print out messages/values
    }

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    George Birbilis <birbilis@kagi.com>
    Microsoft MVP J# for 2004, 2005
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + QuickTime controls (Delphi & ActiveX: VB, PowerPoint, .NET)
    + Plugs (InterProcess/Internet communication)
    + TranXform (VB6 form to ASP.net WebForm convertion)
    http://www.kagi.com/birbilis
    + Robotics
    http://www.mech.upatras.gr/~robgroup
    ........................................................................


  • Next message: George Birbilis [MVP J#] [9880]: "Re: System.Windows.Forms.UserControl as JPanel parent?"

    Relevant Pages

    • (patch for Bash) regex conditional tests
      ... 'regex' are returned in array variable SUBMATCH. ... Skipping of positional parameters, array elements, string ... int dollarflag, zeropad, compareflag; ... SHELL_VAR *var; ...
      (comp.unix.shell)
    • Re: passing char arrays by reference
      ... I want to pass an array of strings to a function: ... int stuff{ ... stuff is an incompatible pointer type. ... string type; a "string" is a data format, ...
      (comp.lang.c)
    • Re: String of numbers into to array of numbers
      ... then read that string and have the string show the ... individual numbers as in an array. ... int arryCnt = 0; ... qStr= cStr.substring); ...
      (comp.lang.java.help)
    • Re: How to Return an array of strings in C (char**)
      ... int start=0; ... // to know the number of elements in the array ... The reason is that you fail to increment str. ... The you could have printed "here" before entering the main loop to see if you actually got there, then str + start to see where you go to in the string on each pass. ...
      (comp.lang.c)
    • Re: read keyboard input and storing in an array?
      ... When in a loop, how do I simply ... The data returned by 'br.readLine' would always be a String so I've stored ... simply convert it to an int as follows: ... you could copy 'myInt' to your array. ...
      (comp.lang.java.help)

    Loading