What's is wrong with this code

import java.awt.*;
public class FormulaOne extends Canvas {
public FormulaOne() {
super();
setSize(300, 200);
setBackground(Color.black);
public static void main(String args[]) {
FormulaOne it = new FormulaOne();
GUIFrame frame = new GUIFrame("Formula One Manager");
frame.add(it);
frame.pack();
frame.setVisible(true);
public void paint(Graphics g) {
Image img1 = Toolkit.getDefaultToolkit().getImage("F1.gif");
g.DrawImage(img1, 0, 0, this);
I get 3 errors
1.GUIFrame frame = new GUIFrame("Formula One Manager");
2.GUIFrame frame = new GUIFrame("Formula One Manager");
3.g.DrawImage(img1, 0, 0, this);
the line underneath the error code is what is given with the IDE iam using (Gel)
The idea of this little code is to get a picture up for my game
Can anybody help

I get 3 errors
1.GUIFrame frame = new GUIFrame("Formula One
Manager");
2.GUIFrame frame = new GUIFrame("Formula One
Manager");
The two are probably related. The code is looking to create
an instance of the class GUIFrame. The compiler won't see
GUIFrame unless you either import it into your source file with
import <<whatever>>.GUIFrame, or have the GUIFrame class within
the same package as your new class.
In addition, you'll also need to make sure that the GUIFrame class
contains a Constructor that takes a single String parameter, or you'll
get an error with that line.
3.g.DrawImage(img1, 0, 0, this);
------------------------------it's g.drawImage, not g.DrawImage

Similar Messages

  • 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...

  • 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);

  • What's wrong with this code (AS3)?

    I want to publish a live stream and, when a button is pressed, publish the same stream for vod.  I haven't been able to get an answer as to whether I can do this...my code is below.  Can someone please tell me if I can do this, or what may be wrong with my code?
    The live stream and playback works fine; but the recording doesn't start.  Also, I want other objects on the client, such as the current camera and audio information, and the aspect ratio being used.  I havent' been able to get these to show up (i.e., the incomingLbl and outgoingLbl do not show up).
    Thank you,
    Phillip A
    My code:
    package {
        import flash.display.MovieClip;
        import flash.net.NetConnection;
        import flash.events.NetStatusEvent; 
        import flash.events.MouseEvent;
        import flash.events.AsyncErrorEvent;
        import flash.net.NetStream;
        import flash.media.Video;
        import flash.media.Camera;
        import flash.media.Microphone;
        import fl.controls.Button;
        import fl.controls.Label;
        import fl.controls.TextArea;
        import fl.controls.CheckBox;
        public class vodcast1 extends MovieClip {
            private var nc:NetConnection;
            private var nc2:NetConnection;
            private var ns:NetStream;
            private var ns2:NetStream;
            private var nsPlayer:NetStream;
            private var vid:Video;
            private var vidPlayer:Video;
            private var cam:Camera;
            private var mic:Microphone;
            private var camr:Camera;
            private var micr:Microphone;
            private var clearBtn:Button;
            private var startRecordBtn:Button;
            private var outgoingLbl:Label;
            private var incomingLbl:Label;
            private var myMetadata:Object;
            private var outputWindow:TextArea;
            private var cb1:CheckBox;
            public function vodcast1(){
                setupUI();
                nc = new NetConnection();
                nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                nc.connect("rtmp://localhost/publishLive");
                nc2 = new NetConnection();
                nc2.connect("rtmp://localhost/vod/videos");
                nc2.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus2);
            private function startRecordHandler(event:MouseEvent):void {
                publishRecordStream();
            private function onNetStatus(event:NetStatusEvent):void {
                trace(event.target + ": " + event.info.code);
                switch (event.info.code)
                    case "NetConnection.Connect.Success":
                        trace("Congratulations! you're connected to live");
                        publishCamera();
                        displayPublishingVideo();
                        displayPlaybackVideo();
                        break;
                    case "NetStream.Publish.Start":
            // NetStatus handler for Record stream       
            private function onNetStatus2(event:NetStatusEvent):void {
                trace(event.target + ": " + event.info.code);
                switch (event.info.code)
                    case "NetConnection.Connect.Success":
                        trace("Congratulations! you're connected to vod");                   
                        break;
                    case "NetConnection.Connect.Rejected":
                    case "NetConnection.Connect.Failed":
                    trace ("Oops! the connection was rejected");
                        break;
                    case "NetStream.Publish.Start":
                        sendMetadata();
                        break;
            private function asyncErrorHandler(event:AsyncErrorEvent):void {
                trace(event.text);
            private function sendMetadata():void {
                trace("sendMetaData() called")
                myMetadata = new Object();
                myMetadata.customProp = "Recording in progress";
                ns.send("@setDataFrame", "onMetaData", myMetadata);
            private function publishRecordStream():void {
                camr = Camera.getCamera();
                micr = Microphone.getMicrophone();
                ns2 = new NetStream(nc2);
                ns2.client = new Object();
                ns2.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus2);
                ns2.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                ns2.attachCamera(camr);
                ns2.attachAudio(micr);
                ns2.publish("vodstream", "record");           
            private function publishCamera():void {
                cam = Camera.getCamera();
                mic = Microphone.getMicrophone();
                ns = new NetStream(nc);
                ns.client = this;
                ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                ns.attachCamera(cam);
                ns.attachAudio(mic);
                ns.publish("livestream", "live");
            private function displayPublishingVideo():void {
                vid = new Video(cam.width, cam.height);
                vid.x = 10;
                vid.y = 30;
                vid.attachCamera(cam);
                addChild(vid); 
            private function displayPlaybackVideo():void {
                nsPlayer = new NetStream(nc);
                nsPlayer.client = this;
                nsPlayer.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
                nsPlayer.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                nsPlayer.play("livestream");
                vidPlayer = new Video(cam.width, cam.height);
                vidPlayer.x = cam.width + 100;
                vidPlayer.y = 30;
                vidPlayer.attachNetStream(nsPlayer);
                addChild(vidPlayer);
            private function setupUI():void {
                outputWindow = new TextArea();
                outputWindow.move(250, 175);
                outputWindow.width = 200;
                outputWindow.height = 50;
                outgoingLbl = new Label();
                incomingLbl = new Label();
                outgoingLbl.width = 100;
                incomingLbl.width = 100;
                outgoingLbl.text = "Publishing Stream";
                incomingLbl.text = "Playback Stream";
                outgoingLbl.move(20, 200);
                incomingLbl.move(300, 200);
                outgoingLbl.condenseWhite = true;
                incomingLbl.condenseWhite = true;
                startRecordBtn = new Button();
                startRecordBtn.width = 150;
                startRecordBtn.move(250, 345);
                startRecordBtn.label = "Start Recording";
                startRecordBtn.addEventListener(MouseEvent.CLICK, startRecordHandler);
                //cb1 = new CheckBox();
                //cb1.label = "Record";
                //cb1.move(135,300);
                //cb1.addEventListener(MouseEvent.CLICK,publishRecordStream);
                //clearBtn = new Button();
    //            clearBtn.width = 100;
    //            clearBtn.move(135,345);
    //            clearBtn.label = "Clear Metadata";
    //            clearBtn.addEventListener(MouseEvent.CLICK, clearHandler);
                addChild(outgoingLbl);
                addChild(incomingLbl);
    //            addChild(clearBtn);
                addChild(startRecordBtn);
    //            addChild(cb1);
                addChild(outputWindow);
            public function onMetaData(info:Object):void {
                outputWindow.appendText(info.customProp);

    use event.currentTarget (and you don't need to repeatedly define the same function):
    var c:int;
    var buttonName:String;
    for (c = 1;c < 5;c++) {
         buttonNum = "button"+c;
         this[buttonNum].addEventListener(MouseEvent.MOUSE_DOWN, pressStepButton);
    function pressStepButton(event:MouseEvent) {          trace(event.currentTarget,event.currentTarget.name);     }

  • What the he** is wrong with this code?

    Hi,
    I have 2 tables. Primary table "resease" and secondary table (containing the foreign key) "kunden".
    Selecting a release (dropdownlist), will show you the corresponding entry of kunden (datatable).
    I added buttons to the datatable for deleting certain rows. This all works fine so far.
    But as you are going to delte the last entry of table kunden, I want to delte the corresponding entry of the table release as well. And by trying to do so, I get an exception telling in line "dataTable1Model.commit();"
    "java.sql.SQLException: Lock time out; try later."
    The exception disappears by deleting the inner try-catch block.
    So what is wrong with this code?
    Thank,
    Mark.
    PS: If you need the database-schema or anything else, let me know....
    public String delete_action() {
            try {
             //returns -1, so I can't use it     
                int rowCount = dataTable1Model.getRowCount();          
             //get affected row     
                com.sun.jsfcl.data.DataCache.Row row =
                dataTable1Model.getDataCache().get(dataTable1Model.getRowIndex());
                row.setDeleted(true);
                try {
                    //New RowSet for getting FK of affected line
                    JdbcRowSetXImpl pkRowSet = new JdbcRowSetXImpl();
                    pkRowSet.setDataSourceName("java:comp/env/jdbc/AVT");
                    pkRowSet.setCommand("SELECT fk_idrelease FROM kunden " +
                    "where fk_idrelease = ?");
                    //Convert Row into string
                    String myRow = row.toString();
                    //Getting the index of the first "=" (it's before the FK)
                    int index = myRow.indexOf("=")+1;
                    //Getting the number (FK) out of the string an casting it to int
                    int fk = Integer.parseInt(myRow.substring(index,(index+1)));
                    //Saving the FK in SessionBean1, so I can use it a parameter of
              //the setObject(int, Object)-method
                    getSessionBean1().setFk(fk);
                    //this will give me a RowSet of all lines containing the FK of
              //the affected row
              pkRowSet.setObject(1, getSessionBean1().getFk());
                    pkRowSet.execute();
                    pkRowSet.last();
                    int numRow = pkRowSet.getRow();
              //If the numRow (numbers of rows) is 1, go to cascade_delte
              //and delte the entry with primary key as well
                    if (numRow == 1) {
                        cascade_delete(); //not implemented yet
                }catch (Exception ex) {
                    error("Error counting affected rows: " + ex);
                dataTable1Model.commit();
                dataTable1Model.execute();
                info("Deleting row OK!");
            }catch (Exception e) {
                log("Page 1: Row delete exception: ", e);
                error("Error during deleting: " + e);
            } // end try catch
          return null;
        }

    just a guess - perhaps call pkRowSet.close() at the end of your try/catch?
    v

  • Contest: Guess whats wrong with this code!

    Can you guess whats wrong with this code snippet? Perhaps its too easy...
    private void clearDefaultTableModel( DefaultTableModel dtm) {    
            int  rowCount  = dtm.getRowCount();
            for(int i =0;  i < rowCount; i++) {
                dtm.removeRow(i);  
        }- Karl XII

    Can you guess whats wrong with this code snippet?
    Perhaps its too easy...
    private void clearDefaultTableModel(
    DefaultTableModel dtm) {    
    int  rowCount  = dtm.getRowCount();
    for(int i =0;  i < rowCount; i++) {
    dtm.removeRow(i);  
    it should be
    private void clearDefaultTableModel(DefaultTableModel dtm) {    
       int  rowCount  = dtm.getRowCount();
       for(int i =0;  i < rowCount; i++) {
         dtm.removeRow(0);  
    }or another way
    private void clearDefaultTableModel(DefaultTableModel dtm) {    
      while(dtm.getRowCount()>0){
         dtm.removeRow(0);  

  • Fed up! dont know whats wrong with this code

    import java.io.*;
    import java.net.*;
    import java.awt.*;
    public class machine {
         private String machine_name;
         private String IP_address;
         public static void main(String[] args) throws IOException {
                   machine server = new machine();
                   server.machine_name = "SERVER1";
                   server.IP_address   = "192.168.0.1";
                   InputStreamReader reads_incoming = null;
                   // Reads incoming Bytes
                   PrintWriter sends_outgoing = null;
                   Socket ping_socket         = null;
                   try{
                        ping_socket = new Socket(server.machine_name , 7);
                        sends_outgoing = new PrintWriter(ping_socket.getOutputStream(),true);
                        reads_incoming = new InputStreamReader(ping_socket.getInputStream());
                   catch (UnknownHostException e){
                        //report error to sole text box
                   catch (IOException e)
                        //similar
                   /* Need a string to send some arbitrary bytes to SERVER1
                    * using IP_address instead , as this field in this implementation
                   while(true)
                        sends_outgoing.println(server.IP_address);
                        if(ping_socket.getInputStream() != null)
                             System.out.print("Server is up");
    }

    same... i am not very experienced, and try and uses this as training... but as new to java programming i could still mention about 5 things that might be wrong with this code... so a deeper explanation would be nice...
    while(true) { } for example seems like a nice way to make infinite loop that can suck your memory out of your computer pretty fast :-) newb

  • Please tell me what is the problem with this code

    Hai,
    Iam new to Swings. can any one tell what is the problem with this code. I cant see those controls on the frame. please give me the suggestions.
    I got the frame ,but the controls are not.
    this is the code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ex2 extends JFrame
    JButton b1;
    JLabel l1,l2;
    JPanel p1,p2;
    JTextField tf1;
    JPasswordField tf2;
    public ex2()
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setTitle("Another example");
    setSize(500,500);
    setVisible(true);
    b1=new JButton(" ok ");
    p1=new JPanel();
    p1.setLayout(new GridLayout(2,2));
    p2=new JPanel();
    p2.setLayout(new BorderLayout());
    l1=new JLabel("Name :");
    l2=new JLabel("Password:");
    tf1=new JTextField(15);
    tf2=new JPasswordField(15);
    Container con=getContentPane();
    con.add(p1);
    con.add(p2);
    public static void createAndShowGUI()
    ex2.setDefaultLookAndFeelDecorated(true);
    public static void main(String ar[])
    createAndShowGUI();
    new ex2();
    }

    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ex2 extends JFrame
        JButton b1;
        JLabel l1,l2;
        JPanel p1,p2;
        JTextField tf1;
        JPasswordField tf2;
        public ex2()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            setTitle("Another example");
            b1=new JButton(" ok ");
            p1=new JPanel();
            p1.add(b1);
            p2=new JPanel();
            p2.setLayout(new GridLayout(2,2));
            l1=new JLabel("Name :");
            l2=new JLabel("Password:");
            tf1=new JTextField(15);
            tf2=new JPasswordField(15);
            p2.add(l1);
            p2.add(tf1);
            p2.add(l2);
            p2.add(tf2);
            Container con=getContentPane();
            con.add(p1, BorderLayout.NORTH);
            con.add(p2, BorderLayout.CENTER);
            pack();
            setVisible(true);
        public static void createAndShowGUI()
            ex2.setDefaultLookAndFeelDecorated(true);
        public static void main(String ar[])
            createAndShowGUI();
            new ex2();
    }

  • Vector, what is the problem with this code?

    Vector, what is the problem with this code?
    63  private java.util.Vector data=new Vector();
    64  Vector aaaaa=new Vector();
    65   data.addElement(aaaaa);
    74  aaaaa.addElement(new String("Mary"));on compiling this code, the error is
    TableDemo.java:65: <identifier> expected
                    data.addElement(aaaaa);
                                   ^
    TableDemo.java:74: <identifier> expected
                    aaaaa.addElement(new String("Mary"));
                                    ^
    TableDemo.java:65: package data does not exist
                    data.addElement(aaaaa);
                        ^
    TableDemo.java:74: package aaaaa does not exist
                    aaaaa.addElement(new String("Mary"));Friends i really got fed up with this code for more than half an hour.could anybody spot the problem?

    I can see many:
    1. i assume your code snip is inside a method. a local variable can not be declare private.
    2. if you didn't import java.util.* on top then you need to prefix package on All occurance of Vector.
    3. String in java are constant and has literal syntax. "Mary" is sufficient in most of the time, unless you purposly want to call new String("Mary") on purpose. Read java.lang.String javadoc.
    Here is a sample that would compile...:
    public class QuickMain {
         public static void main(String[] args) {
              java.util.Vector data=new java.util.Vector();
              java.util.Vector aaaaa=new java.util.Vector();
              data.addElement(aaaaa);
              aaaaa.addElement(new String("Mary"));
    }

  • Whath is wrong with this code???

    Whath is wrong with this code:
    import java.sql.*;
    class DataBaseConnexion
    Connection connexion;
    String url;
    DataBaseConnexion()
    {// 1-charger le driver JDBC-ODBC
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("chargement du driver r�ussi");
    catch(ClassNotFoundException exc) {
    System.out.println("Erreur de chargement du pilote !");
    }// d�finir le pseudo URL pour joindre la BD
    url = "jdbc:odbc:cdi";//2- se connecter � la base de donn�es
    try {
    connexion = DriverManager.getConnection(url, "user_name", "pass_word");
    System.out.println("connexion r�ussie");
    catch(SQLException exc){
    System.out.println("Erreur 1 ! - " + exc.toString());
    public static void main(String Arg[])
    DataBaseConnexion db = new DataBaseConnexion();
    }//this errors occure
    File "C:\Documents and Settings\Administrateur\Bureau\DataBaseConnexion.java" Line 40: Syntax Error
    ---------------- JDK Release Build ------------------
    Compiling C:\Documents and Settings\Administrateur\Bureau\DataBaseConnexion.java
    C:\Documents and Settings\Administrateur\Bureau\DataBaseConnexion.java:40: 'class' or 'interface' expected
    public static void main(String Arg[])
    ^
    C:\Documents and Settings\Administrateur\Bureau\DataBaseConnexion.java:45: 'class' or 'interface' expected
    ^
    C:\Documents and Settings\Administrateur\Bureau\DataBaseConnexion.java:47: 'class' or 'interface' expected
    ^
    3 errors
    Finished

    I think you should remove the last closing curly brackets two lines above the main method.
    Regards

  • What is going wrong with this config ??

    Hello guys,
    I am busting my head to find out what is going wrong with this config and cant figure it out since i am not an advanced cisco technician.
    Problem is that i cant access the 94.70.142.127 server that is supposed to be in a DMZ zone.
    I know it is a bit chaotic but would really appreciate any help since i am running on a deadline.
    I am building the config step by step and although it seems to be working access to the server all of the sudden is denied.
    No idea if its a NAT issue a firewall issue or a security audit issue.
    There are 3 vlans.
    Vlan 1 is the inside network.
    Vlan 2 is the DMZ server
    Vlan 3 is the Management Network.
    thanks in advance
    Building configuration...
    Current configuration : 11796 bytes
    ! Last configuration change at 11:28:33 PCTime Fri Jan 4 2013 by admin
    ! NVRAM config last updated at 11:27:51 PCTime Fri Jan 4 2013 by admin
    version 12.4
    no service pad
    service tcp-keepalives-in
    service tcp-keepalives-out
    service timestamps debug datetime msec localtime show-timezone
    service timestamps log datetime msec localtime
    service password-encryption
    service sequence-numbers
    hostname R1
    boot-start-marker
    boot-end-marker
    security authentication failure rate 3 log
    security passwords min-length 8
    logging message-counter syslog
    logging buffered 4096 informational
    enable secret 5 $1$oT7y$BwhdEjMJfAaTQI3dzDVwP.
    no aaa new-model
    memory-size iomem 10
    clock timezone PCTime 2
    clock summer-time PCTime date Mar 30 2003 3:00 Oct 26 2003 4:00
    crypto pki trustpoint TP-self-signed-2567543707
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-2567543707
    revocation-check none
    rsakeypair TP-self-signed-2567543707
    crypto pki certificate chain TP-self-signed-2567543707
    certificate self-signed 01
      30820244 308201AD A0030201 02020101 300D0609 2A864886 F70D0101 04050030
      31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274
      69666963 6174652D 32353637 35343337 3037301E 170D3133 30313032 30383431
      35335A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649
      4F532D53 656C662D 5369676E 65642D43 65727469 66696361 74652D32 35363735
      34333730 3730819F 300D0609 2A864886 F70D0101 01050003 818D0030 81890281
      8100ABA4 B7FFF4F1 9FBE79D8 2CEBCA68 A14BE3AB DBF770C2 EB35A954 B271AE3E
      F8485837 F2E8566B 66E5EF6B BCFCDFA3 8F6F91F3 FD8E3015 879A67F5 85DD95F5
      C26875C0 2202CA6C CE95888F 545AB4F6 6F708A0E C65E78D1 60967480 5589F5EE
      80505E46 8767CE2C 37C994FE AB555AF0 BA4C4679 63FF7641 34FFF6EF 3EC38006
      46B90203 010001A3 6C306A30 0F060355 1D130101 FF040530 030101FF 30170603
      551D1104 10300E82 0C52312E 646F636E 65742E67 72301F06 03551D23 04183016
      8014F0DE 85318FB3 70C36B4A FEB4B0CA 446025F0 329C301D 0603551D 0E041604
      14F0DE85 318FB370 C36B4AFE B4B0CA44 6025F032 9C300D06 092A8648 86F70D01
      01040500 03818100 5D76D5F4 5FB659C3 1E5B3777 420E1703 CD019889 AE79390D
      A2AA4D26 AD9913B4 B3292277 97ACACDD D7093465 78279B4D 5FAC0A21 EFBF3B74
      6A25BC5B ACFB648F 08F92678 00BB495C 037DEAF7 C5910944 3D2C0643 EA19E9BD
      0AFE5423 AADBB3C2 B2C94296 DABE0D3D 6438F7A8 32B0A92B 3E8E0D26 635070A3
      ACF87E49 65A9E468
          quit
    no ip source-route
    ip cef
    no ip bootp server
    ip domain name docnet.gr
    ip name-server 195.170.0.1
    no ipv6 cef
    username admin privilege 15 view root secret 5 $1$Lny5$et1FhWOpIKOOYRUtN89H10
    archive
    log config
      hidekeys
    ip tcp synwait-time 10
    ip ssh version 2
    class-map type inspect match-any WebService
    match protocol http
    match protocol https
    class-map type inspect match-all sdm-cls-sdm-pol-NATOutsideToInside-1-1
    match class-map WebService
    match access-group name WebServer
    class-map type inspect match-all ccp-cls-sdm-pol-NATOutsideToInside-1-1
    match access-group name Spoofing
    class-map type inspect match-any CCP-Voice-permit
    match protocol h323
    match protocol skinny
    match protocol sip
    class-map type inspect match-any tcp-udp
    match protocol http
    match protocol https
    match protocol dns
    match protocol icmp
    class-map type inspect match-all ccp-cls--3
    match access-group name mng-out
    match class-map tcp-udp
    class-map type inspect match-all ccp-cls--2
    match access-group name mng-self
    class-map type inspect match-all ccp-cls--4
    match access-group name mng-out-drop
    class-map type inspect match-any ccp-cls-insp-traffic
    match protocol cuseeme
    match protocol dns
    match protocol ftp
    match protocol h323
    match protocol https
    match protocol icmp
    match protocol imap
    match protocol pop3
    match protocol netshow
    match protocol shell
    match protocol realmedia
    match protocol rtsp
    match protocol smtp extended
    match protocol sql-net
    match protocol streamworks
    match protocol tftp
    match protocol vdolive
    match protocol tcp
    match protocol udp
    class-map type inspect match-all ccp-insp-traffic
    match class-map ccp-cls-insp-traffic
    class-map type inspect match-any http-https-DMZ
    match protocol http
    match protocol https
    class-map type inspect match-all sdm-cls--2
    match class-map http-https-DMZ
    match access-group name web_server
    class-map type inspect match-any MySQLService
    match protocol mysql
    class-map type inspect match-all sdm-cls--1
    match class-map MySQLService
    match access-group name DMZtoMySQL
    class-map type inspect match-any ccp-cls-icmp-access
    match protocol icmp
    match protocol tcp
    match protocol udp
    class-map type inspect match-all ccp-icmp-access
    match class-map ccp-cls-icmp-access
    class-map type inspect match-all ccp-invalid-src
    match access-group 100
    class-map type inspect match-all sdm-nat-https-1
    match access-group 102
    match protocol https
    class-map type inspect match-all ccp-protocol-http
    match protocol http
    policy-map type inspect ccp-permit-icmpreply
    class type inspect ccp-icmp-access
      inspect
    class class-default
      pass
    policy-map type inspect sdm-pol-NATOutsideToInside-1
    class type inspect ccp-cls-sdm-pol-NATOutsideToInside-1-1
      drop
    class type inspect sdm-cls-sdm-pol-NATOutsideToInside-1-1
      inspect
    class type inspect sdm-nat-https-1
      inspect
    class class-default
      drop
    policy-map type inspect ccp-inspect
    class type inspect ccp-invalid-src
      drop log
    class type inspect ccp-protocol-http
      inspect
    class type inspect ccp-insp-traffic
      inspect
    class type inspect CCP-Voice-permit
      inspect
    class class-default
      drop
    policy-map type inspect ccp-permit
    class class-default
      drop
    policy-map type inspect sdm-policy-sdm-cls--1
    class type inspect sdm-cls--1
      inspect
    class class-default
      drop
    policy-map type inspect ccp-policy-ccp-cls--1
    class class-default
      drop
    policy-map type inspect ccp-policy-ccp-cls--3
    class type inspect ccp-cls--3
      inspect
    class class-default
      drop
    policy-map type inspect sdm-policy-sdm-cls--2
    class type inspect sdm-cls--2
      inspect
    class class-default
      drop
    policy-map type inspect ccp-policy-ccp-cls--2
    class type inspect ccp-cls--2
      inspect
    class class-default
      drop
    policy-map type inspect ccp-policy-ccp-cls--5
    class class-default
      drop
    zone security out-zone
    zone security in-zone
    zone security dmz-zone
    zone security mng
    zone-pair security ccp-zp-self-out source self destination out-zone
    service-policy type inspect ccp-permit-icmpreply
    zone-pair security sdm-zp-NATOutsideToInside-1 source out-zone destination in-zone
    service-policy type inspect sdm-pol-NATOutsideToInside-1
    zone-pair security ccp-zp-in-out source in-zone destination out-zone
    service-policy type inspect ccp-inspect
    zone-pair security ccp-zp-out-self source out-zone destination self
    service-policy type inspect ccp-permit
    zone-pair security zp-dmz-to-outside source dmz-zone destination out-zone
    service-policy type inspect ccp-inspect
    zone-pair security zp-outside-to-dmz source out-zone destination dmz-zone
    service-policy type inspect sdm-pol-NATOutsideToInside-1
    zone-pair security sdm-zp-dmz-zone-in-zone source dmz-zone destination in-zone
    service-policy type inspect sdm-policy-sdm-cls--1
    zone-pair security sdm-zp-in-zone-dmz-zone source in-zone destination dmz-zone
    service-policy type inspect sdm-policy-sdm-cls--2
    zone-pair security sdm-zp-dmz-zone-self source dmz-zone destination self
    service-policy type inspect ccp-policy-ccp-cls--1
    zone-pair security sdm-zp-mng-self source mng destination self
    service-policy type inspect ccp-policy-ccp-cls--2
    zone-pair security sdm-zp-mng-out-zone source mng destination out-zone
    service-policy type inspect ccp-policy-ccp-cls--3
    zone-pair security sdm-zp-out-zone-mng source out-zone destination mng
    service-policy type inspect ccp-policy-ccp-cls--5
    interface Null0
    no ip unreachables
    interface BRI0
    no ip address
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    encapsulation hdlc
    shutdown
    isdn termination multidrop
    interface ATM0
    no ip address
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    no atm ilmi-keepalive
    interface ATM0.1 point-to-point
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    pvc 8/35
      pppoe-client dial-pool-number 1
    interface FastEthernet0
    interface FastEthernet1
    interface FastEthernet2
    switchport access vlan 3
    spanning-tree portfast
    interface FastEthernet3
    switchport access vlan 2
    interface Vlan1
    description $FW_INSIDE$
    ip address 192.168.0.1 255.255.255.0
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    ip nat inside
    ip virtual-reassembly
    zone-member security in-zone
    ip tcp adjust-mss 1412
    interface Vlan2
    description $FW_INSIDE$
    ip address 192.168.1.1 255.255.255.0
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    ip nat inside
    ip virtual-reassembly
    zone-member security dmz-zone
    interface Vlan3
    description $FW_INSIDE$
    ip address 10.0.10.1 255.255.255.0
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip flow ingress
    ip nat inside
    ip virtual-reassembly
    zone-member security mng
    interface Dialer0
    description $FW_OUTSIDE$
    ip address negotiated
    no ip redirects
    no ip unreachables
    no ip proxy-arp
    ip mtu 1452
    ip flow ingress
    ip nat outside
    ip virtual-reassembly max-reassemblies 64
    zone-member security out-zone
    encapsulation ppp
    dialer pool 1
    dialer-group 1
    ppp authentication chap pap callin
    ppp chap hostname [email protected]
    ppp chap password 7 0918425001505245
    ppp pap sent-username [email protected] password 7 13511B4B1359417D
    ip forward-protocol nd
    ip route 0.0.0.0 0.0.0.0 Dialer0
    ip route 10.0.10.0 255.255.255.0 Vlan3
    no ip http server
    ip http secure-server
    ip nat inside source list 1 interface Dialer0 overload
    ip nat inside source static 192.168.0.101 94.70.142.113
    ip nat inside source static 192.168.1.102 94.70.142.127
    ip access-list extended DMZtoMySQL
    remark CCP_ACL Category=128
    permit ip host 192.168.1.102 host 192.168.0.101
    ip access-list extended Spoofing
    remark CCP_ACL Category=128
    permit ip 10.0.0.0 0.255.255.255 any
    permit ip 192.168.0.0 0.0.255.255 any
    permit ip 172.16.0.0 0.15.255.255 any
    ip access-list extended VTY_incoming
    remark CCP_ACL Category=1
    permit ip host 10.0.10.2 any
    ip access-list extended WebServer
    remark CCP_ACL Category=128
    permit ip any host 192.168.1.102
    ip access-list extended mng-out
    remark CCP_ACL Category=128
    permit ip 10.0.10.0 0.0.0.255 any
    ip access-list extended mng-out-drop
    remark CCP_ACL Category=128
    permit ip any any
    ip access-list extended mng-self
    remark CCP_ACL Category=128
    permit ip any any
    ip access-list extended web_server
    remark CCP_ACL Category=128
    permit ip 192.168.0.0 0.0.0.255 host 192.168.1.102
    logging 10.0.10.2
    access-list 1 remark INSIDE_IF=Vlan1
    access-list 1 remark CCP_ACL Category=2
    access-list 1 remark VLan 1 Access
    access-list 1 permit 192.168.0.0 0.0.0.255
    access-list 1 remark VLan 3 Access
    access-list 1 permit 10.0.10.0 0.0.0.255
    access-list 1 remark Vlan 2 Access
    access-list 1 permit 192.168.1.0 0.0.0.255
    access-list 100 remark CCP_ACL Category=128
    access-list 100 permit ip host 255.255.255.255 any
    access-list 100 permit ip 127.0.0.0 0.255.255.255 any
    access-list 102 remark CCP_ACL Category=0
    access-list 102 permit ip any host 192.168.0.101
    dialer-list 1 protocol ip permit
    no cdp run
    control-plane
    banner login ^CWARNING!!!This is a highly monitored private system. Access is prohibited!!^C
    line con 0
    no modem enable
    line aux 0
    line vty 0 4
    access-class VTY_incoming in
    password 7 12292504011C5C162E
    login local
    transport input ssh
    scheduler max-task-time 5000
    ntp authentication-key 1 md5 10603D29214711255F106B2677 7
    ntp authenticate
    ntp trusted-key 1
    ntp master 2
    end

    Hello karolos,
    Here is the thing.
    You said you are trying to access 94.70.142.113 and that is a server on the DMZ but based in your configuration that is not true
    ip nat inside source static 192.168.0.101 94.70.142.113
    So 192.168.0.101 is on Vlan 1 witch is the in-zone
    interface Vlan1
    description $FW_INSIDE$
    ip address 192.168.0.1 255.255.255.0
    security in-zone
    If you got confused with  the security zone that the host is assigned to then just add the following and it should work
    ip access-list extended WebServer
    permit ip any host 192.168.0.101
    Regards

  • Parallelport-whts wrong with this code?

    guys i need to know wht's wrong with this code.i sent the byte x=5 to the parallel port.and tried to read it back intoo another variable y..but the value of y is not returning.
    it showed the errors:
    1. printer port LPT1 :failed to write:IOException
    2.Exception
    java.io.IOException The device is not connected in writebyte
    i have no devices connected to the parallel port.
    my code is included:
    import javax.comm.*;
    import java.io.*;
    public class Parallelio {
    private static OutputStream outputStream;;
    private static ParallelPort parallelPort;
    private static CommPortIdentifier port;
    private static InputStream inputStream;
    // CONSTANT
    public static final String PARALLEL_PORT = "LPT1";
    public static void main(String[] args) {
    try {
         // get the parallel port connected to the printer
    port = CommPortIdentifier.getPortIdentifier(PARALLEL_PORT);
         // open the parallel port -- open(App name, timeout)
    parallelPort = (ParallelPort) port.open("CommTest", 50);
    outputStream = parallelPort.getOutputStream();
         byte x=5;     
         byte y;
         outputStream.write(x);
         inputStream=parallelPort.getInputStream();
         y=(byte)inputStream.read();
         System.out.println("The value read is:"+y);
         outputStream.flush();
         outputStream.close();     
    // inputStream.flush();
         inputStream.close();     
         } catch (NoSuchPortException nspe) {
    System.out.println("\nPrinter Port LPT1 not found : "
    + "NoSuchPortException.\nException:\n" + nspe + "\n");
    } catch (PortInUseException piue) {
    System.out.println("\nPrinter Port LPT1 is in use : "
    + "PortInUseException.\nException:\n" + piue + "\n");
         catch (IOException ioe) {
    System.out.println("\nPrinter Port LPT1 failed to write : "
    + "IOException.\nException:\n" + ioe + "\n");
    } catch (Exception e) {
    System.out
    .println("\nFailed to open Printer Port LPT1 with exeception : "
    + e + "\n");
    } finally {
    if (port != null && port.isCurrentlyOwned()) {
    parallelPort.close();
    System.out.println("Closed all resources.\n");
    regards
    arun
    Message was edited by:
    arun_koshy
    Message was edited by:
    arun_koshy
    Message was edited by:
    arun_koshy

    Hi
    I also need jwrapi package, could someone send me the binaries or the password?
    My email is
    [email protected]
    thank you.

  • HELP PLEASE - WHATS WRONG WITH THIS CODE

    Hi. I get this message coming up when I try to compile the code,
    run:
    java.lang.NullPointerException
    at sumcalculator.SumNumbers.<init>(SumNumbers.java:34)
    at sumcalculator.SumNumbers.main(SumNumbers.java:93)
    Exception in thread "main"
    Java Result: 1
    BUILD SUCCESSFUL (total time: 2 seconds)
    I am not sure whats wrong with the code. Any assistance would be nice. The code is below.
    package sumcalculator;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class SumNumbers extends JFrame implements FocusListener {
    JTextField value1;
    JTextField value2;
    JLabel equals;
    JTextField sum;
    JButton add;
    JButton minus;
    JButton divide;
    JButton multiply;
    JLabel operation;
    public SumNumbers() {
    SumNumbersLayout customLayout = new SumNumbersLayout();
    getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
    getContentPane().setLayout(customLayout);
    value1.addFocusListener(this);
    value2.addFocusListener(this);
    sum.setEditable(true);
    value1 = new JTextField("");
    getContentPane().add(value1);
    value2 = new JTextField("");
    getContentPane().add(value2);
    equals = new JLabel("label_1");
    getContentPane().add(equals);
    sum = new JTextField("");
    getContentPane().add(sum);
    add = new JButton("+");
    getContentPane().add(add);
    minus = new JButton("-");
    getContentPane().add(minus);
    divide = new JButton("/");
    getContentPane().add(divide);
    multiply = new JButton("*");
    getContentPane().add(multiply);
    operation = new JLabel();
    getContentPane().add(operation);
    setSize(getPreferredSize());
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public void focusGained(FocusEvent event){
    try {
    float total = Float.parseFloat(value1.getText()) +
    Float.parseFloat(value2.getText());
    sum.setText("" + total);
    } catch (NumberFormatException nfe) {
    value1.setText("0");
    value2.setText("0");
    sum.setText("0");
    public void focusLost(FocusEvent event){
    focusGained(event);
    public static void main(String args[]) {
    SumNumbers window = new SumNumbers();
    window.setTitle("SumNumbers");
    window.pack();
    window.show();
    class SumNumbersLayout implements LayoutManager {
    public SumNumbersLayout() {
    public void addLayoutComponent(String name, Component comp) {
    public void removeLayoutComponent(Component comp) {
    public Dimension preferredLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    Insets insets = parent.getInsets();
    dim.width = 711 + insets.left + insets.right;
    dim.height = 240 + insets.top + insets.bottom;
    return dim;
    public Dimension minimumLayoutSize(Container parent) {
    Dimension dim = new Dimension(0, 0);
    return dim;
    public void layoutContainer(Container parent) {
    Insets insets = parent.getInsets();
    Component c;
    c = parent.getComponent(0);
    if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,128,40);}
    c = parent.getComponent(1);
    if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+48,128,40);}
    c = parent.getComponent(2);
    if (c.isVisible()) {c.setBounds(insets.left+408,insets.top+48,56,40);}
    c = parent.getComponent(3);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+48,152,40);}
    c = parent.getComponent(4);
    if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+136,72,40);}
    c = parent.getComponent(5);
    if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+136,72,40);}
    c = parent.getComponent(6);
    if (c.isVisible()) {c.setBounds(insets.left+368,insets.top+136,72,40);}
    c = parent.getComponent(7);
    if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+136,72,40);}
    c = parent.getComponent(8);
    if (c.isVisible()) {c.setBounds(insets.left+176,insets.top+48,56,40);}
    }

    Thank you. How do i amend this? I have defined value1though.Yes, you did - but after the call to addFocusListener(...). It needs to be before it.
    BTW, you did the same thing with "value2.addFocusListener(this)" and "sum.setEditable(true)" on the next two lines. You're attempting to call a method on an object that doesn't exist yet (i.e., you haven't called new yet).

  • 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() ?

  • DataOutputStream - whts wrong with this code!?!

    Hi
    I want to write a string to a file already existing on my phone.
    I used the following code but it throws a classNotFound and ConnectionNotFoundException
    I tried the follwoing 2 ways (I think theyr pretty much the same thing):
    1.
    String uri = "c:/documents/flash/my.txt";
    DataOutputSream dos = Connector.openDataOutputStream(uri);
    dos.writeUTF("hi");
    2.
    String uri = "c:/documents/flash/my.txt";
    OutputConnection conn = (OutputConnection)Connector.open(uri",Connector.WRITE);
    DataOutputStream dos = conn.openDataOutputStream();
    dos.writeUTF("hi");
    please can u tell me whts wrong with this or is the method itself that is wrong. how can I solve this... my basic purpose is to write a text to an existing file using a j2me application
    thanx
    Forum M Parmar

    Probably, there is no OutputConnection avalaible... writing files is not standard in j2me!

Maybe you are looking for