just as a rough idea, you need to create a window (JFrame) add a custom component that will draw your house. this might give you an idea, check out the java API for what you can do with the Graphics class
public class MyHouse extends JPanel {
public void paintComponent(Graphics g){
g.drawLine(....)
....
....
}
}
public class Driver {
public static void main(String args) {
JFrame jf = new JFrame();
jf.getContentPane().add(new MyHouse() );
jf.setVisible( true );
}
}
/** Draw a house :)*/
public class house
{
static public void main(String[] args)
{
System.out.println("/\");
System.out.println("/ \");
System.out.println("-");
System.out.println("| - |");
System.out.println("| | ||");
}
}
still not working :(
It gives me 3 errors
2x Unclosed string literal - Lines 6 and 7
and 1x ' } ' expected line 11
/** Draw a house :) */
public class house {
static public void main(String[] args) {
System.out.println("/\\");
System.out.println("/ \\");
System.out.println("-");
System.out.println("| - |");
System.out.println("| | ||");
}
}