[5857] in java-interest
Re: What's wrong with this code ?
daemon@ATHENA.MIT.EDU (brian sharon)
Thu Feb 29 16:48:01 1996
Date: Thu, 29 Feb 1996 10:04:47 -0600 (CST)
From: brian sharon <brian@jjt.com>
To: Pascal Robert <probert@Ergosoft.ergonet.com>
cc: java-interest@java.sun.com
In-Reply-To: <v02140b00ad5a9d707957@[205.236.229.254]>
From the API doc:
public class URLConnection
extends Object
A class to represent an active connection to an object represented by a
URL. It is an abstract class
that must be subclassed to provide implementation of connect.
You can't call connection.connect() because connect() is an abstract
method in the URLConnection class.
--brian
On Wed, 28 Feb 1996, Pascal Robert wrote:
> Hi,
> I am trying to code a little FTP client but my code doesn't work (Mac JDK):
>
> -----------------------------------------------------------------------------
> import java.applet.*;
> import java.awt.*;
> import java.net.*;
>
> public class ftp extends Applet implements Runnable {
>
> Thread timer = null;
> URL site = new URL("ftp","ftp.microsoft.com",21,"*");
> URLConnection connection = new URLConnection(connection);
> try {connection.connect();} catch (IOException e){}
> try {connection.getInputStream();} catch (IOException e){}
> String file = connection.getFile();
>
>
> public void init() {
> resize(300,30);
>
> }
>
> public void paint(Graphics g) {
>
> }
>
> public void start() {
> if(timer == null)
> {
> timer = new Thread(this);
> timer.start();
> }
> }
>
> public void stop() {
> timer = null;
> }
>
> public void run() {
> while (timer != null) {
> try {Thread.sleep(100);} catch (InterruptedException e){}
> repaint();
> }
> timer = null;
> }
>
> public void update(Graphics g) {
> paint(g);
> }
> }
> -------------------------------------------------------------------------
> What's wrong with this code ? The problem is with the try{} method, the
> compiler says that I forgot the type identifier.
>
>
> -
> This message was sent to the java-interest mailing list
> Info: send 'help' to java-interest-request@java.sun.com
>
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com