Urgent help reqd in string tokenizing

hi all,
i want to count the number of commas in the screen,
ths is my code
import java.util.*;
class TokenizerTest
     public static void main(String[] args)
String str= new String("REMOVE_STR,01,6403,40,143,990,410,,,11,ATTN PAT COLEMAN,, ,,,N,,,,,,,,,,,NC,,,,,");
     StringTokenizer st= new StringTokenizer(str,",",false);
     int i=0;
     while(st.hasMoreTokens())
          System.out.println(st.nextToken()+" Val :"+i);
          i++;
     System.out.println("Value of i"+i);
System.out.println("Count is " +st.countTokens());     
}but its notgiving the proper count... those commas whcih are not separated by spaces orcharacter, it desn't count like" ,," it won't count theese commas it works fine when commas are separated by spaces or charachters.
what is the solution for this?.. plz help me its urgent
Thanx in advance
Deepali

countTokens() should have been called before the while loop.
so, System.out.println("Count is " +st.countTokens()); should be place before the while loop or create
a local int variable to store the count and use the variable in the
System.out.println("Count is " + count);
The reason why you're not getting the proper count is this:
    In the while loop..you use nextToken()..when this method is called..countToken() method count the total
    number of token left; therefore...after the while loop..countToken() will always return ZERO.
    you should use the String split(String regex) function, if you are using the jdsk 1.4 or higher.
public static void main(String[] args) {
    String str= new String("REMOVE_STR,01,6403,40,143,990,410,,,11,ATTN PAT COLEMAN,, ,,,N,,,,,,,,,,,NC,,,,,");
    String s[] = str.split(",");  // require jdk 1.4
    // NOTE:   the String "a,,b"      - two commas return
    //    s[0] = "a"    
    //    s[1] = "";    // empty string
    //    s[2] = "";    // empty string
    //    s[3] = "b";
    for (int i = 0; i < s.length; i++)
        System.out.println("Value of i = " + s);
System.out.println("Count is = " + (s.length - 1) );

Similar Messages

  • Urgent Help Reqd: Delta Problem....!!!

    Hi Experts,
    Urgent help reqd regarding follwoing scenario:
    I am getting delta to ODS 1 (infosource : 2LIS_12_VCHDR) from R/3. Now this ODS1 gives delta to Cube1. I got one error record which fails when going to cube (due to master data check).And this record would be edited later.
    So I thought of re loading cube and using error handling to split request in PSA and load valid records in cube.Later when I have coorect info abt error, I would load erroneous record manually using PSA.
    I did following steps:
    1)Failed request is not in cube...(setting is PSA and then into target)....also it has been deleted from PSA.
    2)Remove data status from source ODS1.
    3)Change error handling in infopackage to valid " Valid records update, reporting possible".
    4)start loading of cube.
    But when I did this I got following message :
    <b> "Last delta update is not yet completed.Therefore, no new delta update is possible.You can start the request again if the last delta request is red or green in the monitor"</b>
    But both my requests in cube and ODS are Green...no request is in yellow...!!
    Now the problem is :
    1) I have lost ODS data mart status
    2)how to load valid records to cube, since errorneous record can be edited only after 3- 4 days.
    3)How not to affect delta load of tomorrow.
    Please guide and help me in this.
    Thanks in advance and rest assured I will award points to say thanks to SDNers..
    Regards,
    Sorabh
    Message was edited by: sorabh arora

    Hi Joseph,
    Thanks for replying....
    I apolgize and I have modified the message above..
    I just checked in cube...there is no failed request for today...and neither in PSA....Person who has handed this to me may have deleted this is PSA..and why req is not in failed state in cube...I am not sure..though setting is "PSA and then into data package".....
    So how to go frm here....
    Thanks
    Sorabh

  • URGENT: Help reqd with wwsbr_explorer

    Jerry,
    I am able to create a sitemap by using the above package and passing it the values that I need for site and render type. However, I do not know the values for p_header and p_footer. Can you please help me out.
    Also, I would like to supress the [Return Object] hyperlink. I am quite content with any unsupported bit of code. My client
    cannot wait till 3.1 for the sitemap feature.
    Please help
    Sanjay

    p_header takes the name of a valid string in WWNLS_STRINGS$ table for which the actual string that is displayed is returned. The domain and sub-domain is hardcoded to wws and text respectively. This is the equivalent of:
    v_header := wwnls_api.get_string
    (p_domain=>'wws',
    p_sub_domain=>'text',
    p_name => p_header,
    p_language=>'us');
    v_header would then be the actual header that gets displayed. p_header is the string that identifies the v_header within wws domain and text sub-domain.
    To hide Return Object (remember this will result in the functionality becoming unusable) find all instances of l_robj and the associated 'ReturnObject' and set them to null in sbrexplr.pkb. For example:
    if p_object_type = 'FOLDERMAP' then
    return l_robj;
    under upper(p_menu_type) = 'LABELS' and the associated
    if p_object_type = 'FOLDERMAP' then
    return 'ReturnObject';
    under upper(p_menu_type) = 'COMMANDS' should be set to return NULL:
    if p_object_type = 'FOLDERMAP' then
    return NULL;
    if p_object_type = 'FOLDERMAP' then
    return NULL;
    Another way this was implemented is:
    l_folder_menu.MenuLabel := l_robj;
    l_folder_menu.MenuCmd := 'ReturnObject';
    These should also be set to NULL:
    l_folder_menu.MenuLabel := NULL;
    l_folder_menu.MenuCmd := NULL;
    null

  • Urgent help reqd : DynaValidatorForm with html:multibox

    Hi,
    I've an urgent issue. I'm using a DynaValidatorForm to retreive data from struts <html:multibox> . But when the checkboxes are disabled, even if the boxes are checked, the form fails to retreive the data in the action page. But if I make it enable, it works. Just wondering,if DynaValidatorForm doesn't support disabled checkboxes.
    Also, I tried using hidden parameters instead, but I can't find a way to track the values for which the checke boxes are checked.
    Here's the code I'm using in jsp :
    <logic:notEmpty name="promotionComponentsList">
    <bean:define id="promotionComponentsList" name="promotionComponentsList"/>
    <logic:iterate id="option" name="promotionComponentsList" indexId="pIdx" type="com.jun.esales.epromo.model.referencedata.Option">
    <%if((pIdx.intValue()%2)==0){%>
    <td><html:multibox property="promotionComponent" disabled="<%=!isCreatorEditable%>" onclick="javascript:chgPromotionComponents(this);" value="<%=option.getCode()%>"/>     <bean:write property="name" name="option"/><br>
    <%} else {%>
                                       <html:multibox property="promotionComponent" disabled="<%=!isCreatorEditable%>" onclick="javascript:chgPromotionComponents(this);" value="<%=option.getCode()%>"/>     <bean:write property="name" name="option"/></td>
                                       <%}%>
                                       </logic:iterate>
                             </logic:notEmpty>
    Any pointer on this will be highly appreciated as I'm stuck in this for a while now.
    Thanks,

    If a checkbox (or any html form component for that matter) is disabled, it won't submit a value.
    This is a feature of html - NOT of struts. Struts can't do anything to change this functionality.
    Maybe you could include a hidden field for the value "isCreatorEditable" and only run the validation IF the editable flag is there.
    Good luck,
    evnafets

  • Urgent help reqd on CRM tables/FM/BAdI

    Hi Everybody,
    I'm new to CRM, though old to ABAP. Need some help on the following:-
    1) CRM tables and their relationship too (esp. contract, order, billing, iBase, counter & realted to UBB).
    2) Enhancement of BAdIs.
    3) Setting actions (esp. sending forms at trigger).
    Also, my mail id is [email protected]
    Regards,
    Sanj.

    hi
    as u have these documents with  you now. i appreciate if u could send it to mail id
    [email protected]
    thank you
    chandra

  • Urgent: Help Reqd for outfile

    Hi,
    My Oracle version is 10g and I am using SQL Plus.
    When I use command:
    select * from emp into outfile 'e1.txt';
    it gives me error:
    ORA-00933: SQL command not properly ended
    I have tried all the possible options but none work.
    Please help me solve it,
    thanks,
    R.GOPALAN

      select * from emp into outfile 'e1.txt';
                             ^
                             |
                             |
                             is not a command
    a SELECT statement with an INTO clause is to be used with a PL/SQL. those what you see on the INTO clause are all variables that are declared in PL/SQL code. basically the correct syntax is
      select [column,...] into [variable,...] from [table]
    anyway where do you happen to get the idea that the OUTFILE is an oracle command?

  • Ora-12203 error when connecting to oracle 9i on win2003 - urgent help reqd

    hi
    one of our clients who is on same N3 network and is trying to log on to our oracle 9i database which is installed on windows 2003 + srv pack 1 but is getting ora-12203 erorr.
    the ip address of the client machine has been allowed thr our firewalls and been allowed to use sqlnet on oracle port 1521
    following setting have also been done
    in registry HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME(0) i have set
    USED_SHARED_SOCKET=TRUE
    using Net manager, i have set connection type as DEDICATED_SERVER.
    protocol as TCP/IP and Port no =1521.
    At O/S level we have given oracle_home for 9i access (read, modify execute ..etc) to all sub-folders under e:\orant\ora9i
    i have restarted the listener service and also the windows 2003 server.
    Is there any specific setup criteria which we need to cater when users connect to windows 2003 server
    thanks
    kedar

    Hi Paul
    we have 2 external machine which have been given access thr our firewalls
    our database is in Wales and the machines are in england.
    everything is ok on the server as i have checked the settings which i could know of
    All these machines are on same N3 network , the 2 client machines have DNSlookup set which goes thr all the necessary firewalls and when the following command is run on client machine it can see the server
    c:\> nslookup < machine_name >
    the access to our database is given thr range of ip address as we dont have static IP and when the above command is run it returns dynamic IP address for the database in Wales
    H:\>nslookup krusty.hsw.wales.nhs.uk
    Server: bwd-dc1.bwd.xelpct.nhs.uk
    Address: 10.xxx.xx.xx
    Non-authoritative answer:
    Name: krusty.hsw.wales.nhs.uk
    Address: 194.xxxx.x.xx <---- ip address of databse
    Thanks
    Kedar

  • Urgent Help reqd.

    Hi,
    Can I install and maintain SCM 5.0 without SOLMAN instance? If yes/no why? Please reply. Points gauranteed.
    --Ragu

    Hi Ragu,
    The following SAP notes, give more information about the Solution Manager key that is needed for upgrades and installs to proceed, for later releases:
    <a href="http://service.sap.com/sap/support/notes/805390">805390</a> SAP Solution Manager is required for mySAP ERP 2004
    <a href="http://service.sap.com/sap/support/notes/811923">811923</a> Generating SAP Solution Manager key for mySAP ERP 2004  
    <a href="http://service.sap.com/sap/support/notes/821788">821788</a> Value of SAP Solution Manager for mySAP ERP  
    Regards, Mark

  • Urgent: Help reqd for designing layout

    Hi,
    I need some assistance is designing following scenario:
    How to have a calculated column in the layout?
    Consider a cost center group A having 3 cost centers rolled up under it. First amount is planned for group and then distributed either manually or using function to each of the 3 cost centers.
    1. Now in the layout I want a column which shows % for each cost center of the total amount. Ex: if cost center group A = $300 and each cost center has $100 in it then for which cost center it should show 33.33%.
    2. Also not if this % value is changed then figures should change accordingly. Ex: if for 1 cost center 33.33% is changed to 25% then now its amount should change to $75 and $25 should go to not assigned.
    Note: there is no key figure in the cube which stores this % value. It is something which is required only during planning.
    How can I achieve the above scenario?
    Thank you,
    sam

    Now in the layout I want a column which shows % for each cost center of the total amount. Ex: if cost center group A = $300 and each cost center has $100 in it then for which cost center it should show 33.33%.
    Define the key figure for the percentage and include in the layout as a display column; write a fox formula to derive the % and when you run the fox, the comparison colum will be displayed automatically.
    For examaple:
    = * .80.
    If your percentage varies per cost centre, then define a variable of type numeric value and use VARV command to get the variable value.
    Ravi Thothadri

  • Urgent Help required! - Storing the XML as String instead as a file

    Hi,
    I need urgent help on this.
    I have an XML file. I have used org.w3c.dom to build dom and manipulate the XML file.
    I have updated the values for some of the nodes and I have deleted some of the unwanted nodes.
    I am able to save the output of the DOM as another XML file using
    either transform class or XMLSerializer with OutputFormatter class.
    But my requirement is to save the output of the DOM into a String instead of a file.
    When I save it in String, I need to have the following XML decalration and DOCTYPE declration also with it.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE Test SYSTEM "Test.dtd">
    Can anyone pls help me in this??
    Thanks in Advance. Expecting some inpputs pls....!
    Regards,
    Gayathri.

    hi,
    i think this is what u want
        public static String getXmlString(Document d) {
          StringWriter strResponse = null;
          try {
             OutputFormat format  = new OutputFormat(d);
             strResponse = new StringWriter();
             XMLSerializer serial = new XMLSerializer( strResponse, format );
             serial.asDOMSerializer();
             serial.serialize(d.getDocumentElement());
          catch (Exception e) {
            System.out.println(e.toString());
          return strResponse.toString();
    }HTH
    vasanth-ct

  • Guys I need some help. String token of a wired message

    well this is my code.
    code:
    import java.*;import java.util.StringTokenizer;import java.io.*; class stringtoken {         public static void main(String[] args) {         Runnable daemonRunner = new Runnable()        {                public void run()                        {                         while (true)                                {                    String red, green, blue, yellow, brown, v6, v7;                                        int ali=42;                                         String origtext = "accaa*b*dzddsf*,.sfsdf,a.a/.d,asd.,fa.a/.,/.**asdasdaadf";                                        StringTokenizer st = new StringTokenizer(origtext,"*");                                        try {                                        red = (String)("a" + st.nextToken());                                         green = (String)(st.nextToken());                                        blue = (String)(st.nextToken());                                        yellow = (String)(st.nextToken());                                        brown = (String)(st.nextToken());                                         System.out.println("Red : " + red);                                        System.out.println("Green : "+ green);                                        System.out.println("Red : " + blue);                                        System.out.println("Green : "+ yellow);                                        System.out.println("Blue : " + brown);                                        /////////////////////////////////[shaded section]/////////////////// String red1,red2;int ie=41; String aChar1 = new Character((char)ie).toString(); System.out.println("From above : Red" + red + " *** Will token -> " + aChar1); StringTokenizer st1 = new StringTokenizer(red, ")"); try {                                                red1 = (String)("After splitting 1 :" + st.nextToken());                                                red2 = (String)("After splitting 2 :" + st.nextToken());                                                System.out.println("Output : " + red1 + "&" + red2 );                                                        } catch (Exception ignored) { // (ERROR STATE) could not parse it                                                        } ////////////////////////////////[end of shaded section]/////////////////// int a = 0x41;int i=65; String aChar = new Character((char)i).toString(); System.out.println("Ending : " + aChar); } catch (Exception ignored) { // (ERROR STATE) could not parse it                                        } try {                                                Thread.sleep(1500);                                        } catch (InterruptedException ignored ) {                                        } } } }; Thread daemonThread = new Thread(daemonRunner); daemonThread.setDaemon(false); daemonThread.start(); try {                Thread.sleep(1000);                } catch (InterruptedException ignored) {                } } }
    let me explain a lil. The program is actually a daemon. It works fine. In the body run, that's the thingy which did string token. It works fine. But
    i am creating something that will split (1a) into 2 piece, and another will spilt the other piece.
    The senario, the daemon will receive a string, like "*abcde,1,2,3,hello%"
    where * = STX (ASCII 02) and % ETX (ASCII 03)
    the first loop will eliminate the STX, then seggregate the text to a loop, for example a=abcde, b=1, c=3, d=hello%.
    *what i managed to do is only string token the normal characters, not the ASCII characters 
    then the final loop will grab strtoken the % char.
    i have been trying tht for 1 whole days.. n e ideas guys ?
    thanks in advance.
    you could also post the edited text to [email protected]

    I have solve the problem. Thanks guys!
    import java.*;
    import java.util.StringTokenizer;
    import java.io.*;
    class stringtoken1 {
    public static void main(String[] args) {
         Runnable daemonRunner = new Runnable() {
              public void run() {
                        while (true) {
                        int STX=2, ETX=3, comma=44;
                        String stx = new Character((char)STX).toString();
                        String etx = new Character((char)ETX).toString();
                        String flag= null;
                        String ID= null;
                        String date= null;
                        String location= null;
                        String mobile= null;
                        String outtouser= null;
                        String message1=null;
                        String message2=null;
                        String origtext = stx+"1,001,17062005 16:16:16,Rawang, Telekom, Please stand by "+etx;
                        //System.out.println(origtext);
                                            String throwstx = new Character((char)STX).toString();
                                            StringTokenizer stxthrow1 = new StringTokenizer(origtext, throwstx);
                                            try {
                                                  message1 = (String)(stxthrow1.nextToken());
                                            catch (Exception ignoredthrowstx) {System.out.println(ignoredthrowstx);}
                                            String throwetx = new Character((char)ETX).toString();
                                            StringTokenizer etxthrow = new StringTokenizer(message1, throwetx);
                                            try {
                                                       message2 = (String)(etxthrow.nextToken());
                                            catch (Exception ignoredthrowstx) {System.out.println(ignoredthrowstx);}
                                            String chomma = new Character((char)comma).toString();
                                            StringTokenizer st = new StringTokenizer(message2,chomma);
                                            try {
                                                      flag = (String)(st.nextToken());
                                                      ID = (String)(st.nextToken());
                                                      date = (String)(st.nextToken());
                                                      location = (String)(st.nextToken());
                                                      mobile = (String)(st.nextToken());
                                                      outtouser = (String)(st.nextToken());
                                            catch (Exception ignoredcomma) {System.out.println(ignoredcomma);}
                                            System.out.println("Original Message : " + origtext);
                                            System.out.println("After STX : " + message1);
                                            System.out.println("After ETX : " + message2);
                                            System.out.println("Filtering");
                                            System.out.println("flag : " + flag);
                                            System.out.println("id : "+ ID);
                                            System.out.println("date : " + date);
                                            System.out.println("location : "+ location);
                                            System.out.println("mobile : " + mobile);
                                            System.out.println("message : " + outtouser);
                             try {
                              Thread.sleep(3000);
                              catch (InterruptedException ignored ) { }
    Thread daemonThread = new Thread(daemonRunner); daemonThread.setDaemon(false);
    daemonThread.start();
    try { Thread.sleep(1000);}
    catch (InterruptedException ignored){ }
    }for others guys as well :)

  • URGENT HELP NEEDED!!! (Almost a matter of life and death)

    Well, it's more of a matter of failing a course or not...
    Anyway, my Java professor gave us some labs to do. I know Java front and back, at least, whatever version I learned a few years back. This is my first tenure with the Scanner object, and it's messing me up.
    I'm using Eclipse for my project. I have three files in the source folder, ABC_Manufacturing.java, mseast.dat and mswest.dat. Now, when I try to instanciate a new Scanner object, it won't find the files:
    Scanner east = new Scanner(new FileReader("mseast.dat"));
    Scanner west = new Scanner(new File("mswest.dat"));
    I'm trying two seperate ways to do this. Neither are working, this is the error I get:
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         Unhandled exception type FileNotFoundException
         Unhandled exception type FileNotFoundException
         at ABC_Manufacturing.main(ABC_Manufacturing.java:38)
    Now, I added these files OVER and OVER again. I added them. I created new files and pasted the contents in there. I used .txt files. All the same error. It's like it just won't take the time out to look for the files that are RIGHT IN THE DAMN PROJECT! Then I tried using a complete path, using C:\Java\whatever. SAME ERROR!!!!
    Please, I need urgent help. This is due tomorrow at noon, and I have no idea what to do at this point. I can't really continue, because at this point its just looking at what prints out and formatting it, and I don't want to do that without testing to see if my code to convert the file data into arrays work. You dig? Thanks for any and all help, and I'm going to kill my professor...she spent a week going over parallel arrays but did nothing to show us how to import files into projects or use the scanner class. Also it doesn't help that at uni we have to use emacs, which I don't use at home.

    d00erino wrote:
    This is the the main class, so far:
    public static void main(String[] args)throws IOException
              Scanner west = new Scanner(new File("mswest.dat"));
              int [] eastParts = new int[13];
              int [] eastQuant = new int[13];
              int [] westParts = new int[17];
              int [] westQuant = new int[17];
              System.out.print(west.nextInt());
    And I didn't ignore that one guy (sorry, don't remember your username) I tried you and the other guy's responce. Both didn't work. I dunno how to get around errors. Figures, you don't learn that in the course but she'll spend a week on parallel arrays...Ok, well that can't possibly be complaining with the same error message you got before, so now you need to be (more) specific about what "didn't work" means.

  • Urgent  help needed(java frames)

    Hi,
    I need urgent help for correcting a piece of code.
    I have written a piece of code for building a gui with some buttons, drawing some geometric shapes.The code consists of two files called Graph and Frame.
    The problem I suppose in the last part of the Graph file, which Rectangle and Circle are called together, the only shape that the program draws is rectangle.Here is the code:
    //Graph
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.util.*;
    public class Graph extends JPanel {
    LinkedList color;
    LinkedList figures;
    public Graph() {
    setBackground(Color.white);
    figures = new LinkedList();
    color = new LinkedList();
    int z;
    class Point {
    int x;
    int y;
    public Point(int x, int y) {
    this.x = x;
    this.y = y;
    public Point(Point p) {
    x = p.x;
    y = p.y;
    public String toString() {
    return "(" + x + ", " + y + ")";
    public void move(Point dist) {
    x += dist.x;
    y += dist.y;
    abstract class GeomFigur {
    public abstract void move(Point p);
    class Line extends GeomFigur {
    Point p1, p2;
    public Line(Point p1, Point p2) {
    this.p1 = new Point(p1);
    this.p2 = new Point(p2);
    public String toString() { return "Line from " + p1 + " to " + p2;  }
    public void move(Point dist) {
    p1.move(dist);
    p2.move(dist);
    class Rectangle extends Line {
    public Rectangle(Point p1, Point p2) {
    super(p1, p2);
    public String toString() { return "Rectangle from " + p1 + " to " + p2; }
    class Circle extends GeomFigur{
    Point centre;
    int radius;
    public Circle(Point centre, int radius) {
    this.centre = new Point(centre);
    this.radius = radius;
    public String toString() {
    return "Circle, centre " + centre + ", radius " + radius;
    public void move(Point dist) { centre.move(dist); }
    public void addRectangle(int x, int y, Color col) {
    Rectangle r =new Rectangle(new Point(x,y),new Point(x+20,y+20));
    figures.addLast(r);
    color.addLast(col);
    repaint();
    public void addCircle(int x, int y, Color col) {
    Circle c =new Circle(new Point(x,y), 1 );
    figures.addLast(c);
    color.addLast(col);
    repaint();
    public void paintComponent(Graphics g) {
    super.paintComponent(g);
    for (int i=0;i < figures.size();i++) {
    Rectangle rect = (Rectangle)figures.get(i);
    //Circle circ = (Circle)figures.get(i);
    g.setColor(Color.black);
    g.drawRect(rect.p1.x,rect.p1.y,20,20);
    g.setColor((Color)color.get(i));
    g.fillRect(rect.p1.x,rect.p1.y,20,20);
    //g.setColor(Color.black);
    // g.drawOval(circ.centre.x,circ.centre.y,20,20);
    // g.setColor((Color)color.get(i));
    // g.fillOval(circ.centre.x, circ.centre.y, 20, 20);
    //Frame
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    public class Frame extends JFrame implements ActionListener {
    JButton button1, button2, button3, button4, button5 ;
    Graph gr;
    JComboBox cbx;
    JComboBox cby;
    JComboBox col;
    JMenu filemenu;
    JMenuItem quit;
    JMenuBar menubar;
    int x=10;
    int y=10;
    Color color=Color.red;
    public Frame() {
    menubar = new JMenuBar();
    filemenu = new JMenu("File");
    filemenu.setMnemonic('F');
    quit = new JMenuItem("Quit");
    quit.addActionListener(this);
    quit.setMnemonic('Q');
    quit.setAccelerator(KeyStroke.getKeyStroke('Q',Event.CTRL_MASK,false));
    filemenu.add(quit);
    menubar.add(filemenu);
    setJMenuBar(menubar);
    button1 = new JButton("Rectangle");
    button1.addActionListener(this);
    button2 = new JButton("Circle");
    button2.addActionListener(this);
    button4 = new JButton("Ellipse");
    button4.addActionListener(this);
    button5 = new JButton("Triangle");
    button5.addActionListener(this);
    button3 = new JButton("Reset");
    button3.addActionListener(this);
    String[] elements_x= {"10","20","30","40","50","60","70"};
    cbx = new JComboBox(elements_x);
    cbx.addActionListener(this);
    cbx.setActionCommand("cbx");
    String[] elements_y= {"10","20","30","40","50","60","70"};
    cby = new JComboBox(elements_y);
    cby.addActionListener(this);
    cby.setActionCommand("cby");
    String[] elements_color = {"Red","Blue","Green","Orange","Yellow" };
    col = new JComboBox(elements_color);
    col.addActionListener(this);
    col.setActionCommand("col");
    gr = new Graph();
    JPanel top = new JPanel(new BorderLayout());
    JPanel inputs = new JPanel(new GridLayout(6,1));
    inputs.add(button1);
    inputs.add(button2);
    inputs.add(button3);
    inputs.add(button4);
    inputs.add(button5);
    inputs.add(cbx);
    inputs.add(cby);
    inputs.add(col);
    top.add(gr,BorderLayout.CENTER);
    top.add(inputs,BorderLayout.WEST);
    getContentPane().add(BorderLayout.CENTER, top);
    setSize(500,300);//set window size
    //take care of actions
    public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();
    if (command.equals("Quit")){
    System.exit(0);//terminate program
    else if (command.equals("Rectangle")){
    //add Rectangle to graph at
    //position x,y and with certain color
    gr.addRectangle(x,y,color);
    else if (command.equals("Circle")){
    gr.addCircle(x,y,color);
    else if (command.equals("Reset")){
    else if (command.equals("Triangle")){
    else if (command.equals("Ellipse")){
    else if (command.equals("cbx")){
    x=Integer.valueOf((String)((JComboBox)e.getSource()).getSelectedItem()).intValue();
    else if (command.equals("cby")){
    y=Integer.valueOf((String)((JComboBox)e.getSource()).getSelectedItem()).intValue();
    else if (command.equals("col")){
    String temp=(String)((JComboBox)e.getSource()).getSelectedItem();
    if (temp=="Red") color=Color.red;
    else if (temp=="Blue") color=Color.blue;
    else if (temp=="Green") color=Color.green;
    else if (temp=="pink") color=Color.pink;
    else if (temp=="lightGray") color=Color.lightGray;
    //main program
    public static void main(String [] args) {
    Frame appl = new Frame();
    appl.setVisible(true);
    Thanks in advance
    Marina

    Hi,
    You are very lucky that I'm currently boored. You should never tag a question as urgent. It might be urgent to you, but not to us who answer. And you should also use code formatting when you post code (see the formatting tips, or use the code-button).
    I made some changes to your Graph class. The most important thing is the abstract draw method that I added to the GeomFigur class.
    import java.awt.*;
    import javax.swing.*;
    import java.util.*;
    public class Graph extends JPanel {
        LinkedList figures;
        public Graph() {
            setBackground(Color.white);
            figures = new LinkedList();
        int z;
        abstract class GeomFigur {
            protected Color color;
            public GeomFigur(Color color) {
                this.color = color;
            public abstract void move(Point p);
            public abstract void draw(Graphics g);
        abstract class Line extends GeomFigur {
            Point p1, p2;
            public Line(Color c, Point p1, Point p2) {
                super(c);
                this.p1 = new Point(p1);
                this.p2 = new Point(p2);
            public String toString() {
                return "Line from " + p1 + " to " + p2;
            public void move(Point dist) {
                p1.move(dist.x, dist.y);
                p2.move(dist.x, dist.y);
        class Rectangle extends Line {
            public Rectangle(Color c, Point p1, Point p2) {
                super(c, p1, p2);
            public String toString() {
                return "Rectangle from " + p1 + " to " + p2;
            public void draw(Graphics g) {
                System.out.println("Draw rectangle at " + p1 + " with color " + color);
                g.setColor(Color.black);
                g.drawRect(p1.x, p1.y, 20, 20);
                g.setColor(color);
                g.fillRect(p1.x, p1.y, 20, 20);
        class Circle extends GeomFigur {
            Point centre;
            int radius;
            public Circle(Color c, Point centre, int radius) {
                super(c);
                this.centre = new Point(centre);
                this.radius = radius;
            public String toString() {
                return "Circle, centre " + centre + ", radius " + radius;
            public void move(Point dist) {
                centre.move(dist.x, dist.y);
            public void draw(Graphics g) {
                System.out.println("Draw circle at " + centre + " with color " + color);
                g.setColor(Color.black);
                g.drawOval(centre.x, centre.y, 20, 20);
                g.setColor(color);
                g.fillOval(centre.x, centre.y, 20, 20);
        public void addRectangle(int x, int y, Color col) {
            System.out.println("x,y,col " + x + ":" + y + ":" + col);
            Rectangle r = new Rectangle(col, new Point(x, y), new Point(x + 20, y + 20));
            figures.addLast(r);
            repaint();
        public void addCircle(int x, int y, Color col) {
            System.out.println("x,y,col" + x + ":" + y + ":" + col);
            Circle c = new Circle(col, new Point(x, y), 1);
            figures.addLast(c);
            repaint();
        public void paintComponent(Graphics g) {
            super.paintComponent(g);
            for (int i = 0; i < figures.size(); i++) {
                GeomFigur drawable = (GeomFigur)figures.get(i);
                drawable.draw(g);
    }/Kaj

  • URGENT HELP REQUIRED!

    I am having problems implementing a username validaion bean for my login system. Every time I click my login icon on my main JSP page the login JSP page does not appear except one of the error JSP pages.
    How can I correct this problem?
    Does the code below look correct?
    Below is the codes for the Username Validation Bean :
    LOGIN.JSP
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="com.mysql.jdbc.*"%>
    <%@ page errorPage="badLogin.jsp"%>
    <%@ page import="gcd.UserNameValidationBean"%>
    <%
    Class.forName("com.mysql.jdbc.Driver");
    java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
    java.sql.Statement statement = connection.createStatement();
    Enumeration parameters = request.getParameterNames();
    if(parameters.hasMoreElements())
    String usernameValue = request.getParameter("username");
    String passwordValue = request.getParameter("password");
    statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+usernameValue+"','"+passwordValue+"')");
    %>
    GOODLOGIN.JSP
    <%@ page errorPage="badLogin.jsp"%>
    <%@ page import="gcd.UserNameValidationBean"%>
    <% UserNameValidationBean validationBean = new UserNameValidationBean();
    if(request.getParameter("username")!=null)
    validationBean.validateUserNameBean(request.getParameter("username"));
    %>
    <%=request.getParameter("username")%>
    USERNAMEVALIDATIONBEAN.JAVA
    package gcd;
    public class UserNameValidationBean
    public UserNameValidationBean(){}
    public boolean validateUserName(String userName) throws InvalidUserNameException
    if(userName.length() < 32)
    throw new InvalidUserNameException("User Name Invalid: " + userName);
    return true;
    INVALIDUSERNAMEEXCEPTION.JAVA
    package gcd;
    public class InvalidUserNameException extends Exception
    public InvalidUserNameException(String message)
    super(message);
    I need urgent help to get this working!

    Here is code for badLogin.jsp and badLoginWithExceptonObject:
    BADLOGIN.JSP
    <HTML><HEAD><TITLE>Login Failure</TITLE></HEAD>
    <BODY bgcolor="#FF9900">
    <H1></H1>
    <font face="Arial" size="3">Sorry but you either entered an incorrect username
    or password </font>
    <P><font face="Arial" size="3">Try Again</font>
    </BODY></HTML>
    BADLOGINWITHEXCEPTIONOBJECT.JSP
    <HTML><HEAD><TITLE>Check User Login Against Parameters</TITLE></HEAD>
    <BODY bgcolor="#FF9900">
    <%@ page isErrorPage = "true"%>
    <P><font face="Arial" size="3">Error =</font> <%= exception.getMessage()%> <% PrintWriter writer = new PrintWriter(out); %>
    <P><font face="Arial" size="3">Stack =</font> <% exception.printStackTrace(writer); %>
    <P><font face="Arial" size="3">Try Again</font>
    </BODY></HTML>

  • Urgent Help Required for Connect Four Game

    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
         int player1;
         int player2;
         public PlayGame()
              //this.player1 = player1;
              //this.player2 = player2;
         public void StartGame()
         try{
         // int X = 0, Y = 0;
         //int value;
         int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
         int[][] ConnectFourArray = new int[6][7];
         int num1, num2;
         for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
         //Player player1;
         //Player player2;
         public ClassConnectFour()
              //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end class
    I am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda
    //

    Hi,
    Thanks for your help but I really don't understand the table lookup algorithm. Could you please send me some code to implement that.
    I will send you the formatted code as well
    Thanks for your help.
    looking forward to your reply.
    Koonda
    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
    int player1;
    int player2;
    public PlayGame()
    //this.player1 = player1;
    //this.player2 = player2;
    public void StartGame()
    try{
    // int X = 0, Y = 0;
    //int value;
    int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    int[][] ConnectFourArray = new int[6][7];
    int num1, num2;
    for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
    //Player player1;
    //Player player2;
    public ClassConnectFour()
    //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end classI am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda

Maybe you are looking for

  • Fore Closing Sales Order

    Hi I have created a sales order for items 1000 Qty and delivered 600 qty remaning 400 qty has to be fore closed automatically and must  not appear  in open list

  • Having trouble with Yahoo home page sign in. Some time it brings up my wife's Yahoo log in instead of my log in how can I fix this?

    When I open Firefox it is suppose to take me to my Yahoo home page. But it opens up showing my wifes Yahoo sigh in page in stead of mine. Having trouble with Yahoo home page sign in. Some time it brings up my wife's Yahoo log in instead of my log in

  • HTC Incredible 4.08 update stuck in "Rebooting now..."

    I received the 4.08 OTA update today morning. On the first try I ended up with the "Not enough space to install update" message. I then freed up space (deleted SMS messages, data from apps etc) and set the date to Dec 16th, 2010. This caused the upda

  • Gnu-crypto PKCS7 NegativeArraySizeException

    Hi guys, i read a lot of topics in the forum, but i cant find something that could help me, so i post a topics. I hope somebody help me. Im trying to do a simple PKCS7 padding using gnu-crypto, but when a run the padding example that come with the di

  • IOS 7.0.6 Update Failure!?!?!?!?!?

    OK so, my iphone stated that it had a software update iOS 7.0.6. I went to the settings and clicked it. Its started updating fine. Then suddenly it stopped! I restarted it, put it on charge, and went to bed. 12 hours later, it's still stuck! What do