Results 1 to 2 of 2
  1. #1
    kank635 is offline Member
    Join Date
    Dec 2011
    Posts
    1
    Rep Power
    0

    Default What is wrong in this code of java

    import javax.swing.*;


    public class shape
    {


    public static void main(String[] args)
    {
    JFrame f=new JFrame("hi");
    f.setSize(300,200);
    f.setDefaultCloseOperation(JFrame.EX…
    f.setVisible(true);
    draw ob1=new draw();
    f.add(ob1);
    }
    }



    /*************************************…


    import java.awt.*;
    //import java.awt.color.*;

    public class draw extends JFrame
    {
    public void paint(Graphics g)
    {
    g.drawOval(10, 10, 50, 50);
    g.fillOval(5, 5, 10, 10);

    }
    }

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default Re: What is wrong in this code of java

    Hi kank635, welcome to the forums!

    If you find a problem with the code it might be a good idea if *you* said what it is. Specifically, does the code compile? If not and you can't understand the compiler's messages post them and someone is sure to explain what they mean.

    Or does the code compile but you find it does not do what you expect or intend when you run it? In that case describe what the program *does* do (including any runtime errors) as well as what you expected or intended it would do.

    Also, please format code. The idea is you put [code] at the start of the code and [/code] at the end. That way the code will be nicely formatted and readable when it appears here.

Similar Threads

  1. What is wrong with my code????
    By maneatingbaby in forum New To Java
    Replies: 2
    Last Post: 12-31-2010, 06:06 PM
  2. What is wrong with my code?
    By loosemember in forum New To Java
    Replies: 1
    Last Post: 12-03-2010, 01:20 AM
  3. Please look at my java code and tell me what's wrong
    By xcointoss in forum Advanced Java
    Replies: 3
    Last Post: 10-22-2010, 04:15 AM
  4. what wrong with my java code
    By MAXZZXAM in forum New To Java
    Replies: 3
    Last Post: 11-19-2009, 09:38 AM
  5. what's wrong with my code? please help me...
    By lovely23 in forum Java Applets
    Replies: 2
    Last Post: 03-01-2009, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •