getting identifier expected error

can any1 plese help me out in solving the <identifier > expected error in the given code below

import java.applet.*;

import java.awt.*;

import java.awt.event.*;

import java.io.*;

/*

<applet code="part1" width=500 height=500>

</applet>

*/

public class part1 extends Applet implements ActionListener

{

Class.forName("oracle.jdbc.driver.OracleDriver");//error coming here

Statement stmt;

Connection conn=null;

//Making the database connection

conn = DriverManager.getConnection("jdbc:Oracle:thin:bharat/bharat@mdrrcc");//here again the error is coming

stmt = conn.createStatement();//here again same error

ResultSet rs;

String query;

query = "SELECT * FROM BHARAT";//again here

rs = stmt.executeQuery(query);//here again

[854 byte] By [brittle_bonda] at [2007-11-27 10:55:00]
# 1

So you have non-declarative statements outside any method or c'tor or initializer. Don't do that.

CeciNEstPasUnProgrammeura at 2007-7-29 11:53:39 > top of Java-index,Java Essentials,Java Programming...
# 2

i didnt get wht u r trying to say

can u plzz make me understand that

thanx

brittle_bonda at 2007-7-29 11:53:39 > top of Java-index,Java Essentials,Java Programming...
# 3

> i didnt get wht u r trying to say

> can u plzz make me understand that

> thanx

How ironic.

U nd 2 hv a ctor r mthd r wtever 2 put ur codez in.

Or, in very simple terms: you can't have code outside of any methods, because there wouldn't be anything to run it.

Go and read up on the Java basics. And maybe take some typing lessons.

CeciNEstPasUnProgrammeura at 2007-7-29 11:53:39 > top of Java-index,Java Essentials,Java Programming...
# 4

This looks interesting. A total newbie to Java (apparently) is building an applet that will apparently connect to an oracle database and he doesn't even know that code must go inside a method or a constructor (or static/instance initializer block).

Great, I foresee great accomplishments for this person.

-Kayaman-a at 2007-7-29 11:53:39 > top of Java-index,Java Essentials,Java Programming...
# 5

> Great, I foresee great accomplishments for this

> person.

I see capitalization opportunities. Account fraud, industrial espionage... To bad I was never really fond of that cra-cker business.

CeciNEstPasUnProgrammeura at 2007-7-29 11:53:39 > top of Java-index,Java Essentials,Java Programming...