
Untitled
By: a guest on
Aug 7th, 2012 | syntax:
None | size: 1.97 KB | hits: 5 | expires: Never
Unable to run Thread programme
public class Myth extends Thread {
public void run() {
int val=65;
try {
for(int i=0;i<26;i++) {
System.out.println((char)val);
val++;
sleep(500);
}
}
catch(InterruptedException e) {
System.out.println(e);
}
// error pops up on this bracket saying class interface or enum expected.
// error in this line says-- illegal start of expression
public static void main(String args[]) {
Myth obj=new Myth();
obj.start();
}
}
}
public class Myth extends Thread{
public void run(){
int val=65;
try{
for(int i=0;i<26;i++){
System.out.println((char)val);
val++;
sleep(500);
}
}catch(InterruptedException e){
System.out.println(e);
}
}
public static void main(String args[]){
Myth obj=new Myth();
obj.start();
}
}
public class Myth extends Thread {
public void run() {
int val = 65;
try {
for (int i = 0; i < 26; i++) {
System.out.println((char) val);
val++;
sleep(500);
}
}
catch (InterruptedException e) {
System.out.println(e);
}
}
public static void main(String args[]) // error in this line says-- illegal
// start of expression
{
Myth obj = new Myth();
obj.start();
}
}
public class Myth extends Thread {
public void run(){
int val=65;
try {
for(int i=0;i<26;i++)
{
System.out.println((char)val);
val++;
sleep(500);
}
}catch(InterruptedException e){
System.out.println(e);
}
// error pops up on this bracket saying class interface or enum expected.
// error in this line says-- illegal start of expression
}
public static void main(String args[]){
Myth obj=new Myth();
obj.start();
}
}