Click here to Skip to main content
15,887,776 members
Home / Discussions / Java
   

Java

 
GeneralRe: Creating a class that extends more than one class. Pin
Bill.Moo4-Oct-12 3:48
Bill.Moo4-Oct-12 3:48 
AnswerRe: Creating a class that extends more than one class. Pin
Peter_in_27804-Oct-12 3:03
professionalPeter_in_27804-Oct-12 3:03 
GeneralRe: Creating a class that extends more than one class. Pin
Bill.Moo4-Oct-12 3:59
Bill.Moo4-Oct-12 3:59 
GeneralRe: Creating a class that extends more than one class. Pin
Peter_in_27804-Oct-12 11:36
professionalPeter_in_27804-Oct-12 11:36 
AnswerRe: Creating a class that extends more than one class. Pin
pasztorpisti4-Oct-12 12:14
pasztorpisti4-Oct-12 12:14 
QuestionRe: Creating a class that extends more than one class. Pin
Monster Maker21-Oct-12 21:08
Monster Maker21-Oct-12 21:08 
AnswerRe: Creating a class that extends more than one class. Pin
Gowtham Gutha15-Nov-12 6:59
Gowtham Gutha15-Nov-12 6:59 
QuestionThread names Pin
Neo101014-Oct-12 1:19
Neo101014-Oct-12 1:19 
App.java
Java
Thread runnable1 = new Thread(new MyThreadRunnable(), "runnable1");
runnable1.setName(runnable1.getName());
runnable1.start();

MyThreadRunnable.java
Java
public class MyThreadRunnable implements Runnable {
    private String name;

    public void setName(String name){
        this.name=name;
    }

    public void run() {
        System.out.println("Testing MyThreadRunnable"+" "+name);
    } 
}


Why does line 2 of App.java result in a 'null' for the name member of MyThreadRunnable? Is it not so that I just created a new Thread, passed a Runnable to it and gave it a name? Is it not supposed to be so that the name property should carry the value of Thread's getName()?

I don't understand.
AnswerRe: Thread names Pin
Nagy Vilmos4-Oct-12 2:54
professionalNagy Vilmos4-Oct-12 2:54 
AnswerRe: Thread names Pin
Gowtham Gutha15-Nov-12 7:11
Gowtham Gutha15-Nov-12 7:11 
Questionget ethernet IP address Pin
hari3013-Oct-12 19:30
hari3013-Oct-12 19:30 
AnswerRe: get ethernet IP address Pin
TorstenH.3-Oct-12 19:58
TorstenH.3-Oct-12 19:58 
AnswerRe: get ethernet IP address Pin
jschell4-Oct-12 11:44
jschell4-Oct-12 11:44 
QuestionJava Based Websevice Pin
ashish121693-Oct-12 1:55
ashish121693-Oct-12 1:55 
AnswerRe: Java Based Websevice Pin
Richard MacCutchan3-Oct-12 2:34
mveRichard MacCutchan3-Oct-12 2:34 
AnswerRe: Java Based Websevice Pin
TorstenH.3-Oct-12 2:36
TorstenH.3-Oct-12 2:36 
QuestionHow can I change a 8-bit bitmap into a 4-bit/1-bit bitmap? Pin
Kangvampire2-Oct-12 22:11
Kangvampire2-Oct-12 22:11 
QuestionCreating a Thread Pin
Neo101012-Oct-12 8:17
Neo101012-Oct-12 8:17 
AnswerRe: Creating a Thread Pin
jschell2-Oct-12 8:46
jschell2-Oct-12 8:46 
AnswerRe: Creating a Thread Pin
Richard MacCutchan2-Oct-12 9:32
mveRichard MacCutchan2-Oct-12 9:32 
GeneralRe: Creating a Thread Pin
Neo101012-Oct-12 20:53
Neo101012-Oct-12 20:53 
GeneralRe: Creating a Thread Pin
TorstenH.2-Oct-12 23:31
TorstenH.2-Oct-12 23:31 
AnswerRe: Creating a Thread Pin
Peter_in_27802-Oct-12 22:05
professionalPeter_in_27802-Oct-12 22:05 
AnswerRe: Creating a Thread Pin
Gowtham Gutha15-Nov-12 7:15
Gowtham Gutha15-Nov-12 7:15 
Questionpure java based code needed to read shedule and send an sms Pin
ask.sagaram2-Oct-12 7:08
ask.sagaram2-Oct-12 7:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.