Click here to Skip to main content
15,895,011 members
Home / Discussions / Java
   

Java

 
Questionjava-linkedlist Pin
Bavirti25-Sep-08 1:00
Bavirti25-Sep-08 1:00 
AnswerRe: java-linkedlist Pin
toxcct25-Sep-08 2:19
toxcct25-Sep-08 2:19 
GeneralRe: java-linkedlist [modified] Pin
Bavirti25-Sep-08 2:46
Bavirti25-Sep-08 2:46 
GeneralRe: java-linkedlist Pin
toxcct25-Sep-08 2:49
toxcct25-Sep-08 2:49 
QuestionEquivalent to .net usercontrol Pin
Russell Jones22-Sep-08 22:33
Russell Jones22-Sep-08 22:33 
AnswerRe: Equivalent to .net usercontrol Pin
Russell Jones22-Sep-08 23:10
Russell Jones22-Sep-08 23:10 
QuestionOdd String/Vector behavior [solved] Pin
David Crow19-Sep-08 5:55
David Crow19-Sep-08 5:55 
AnswerRe: Odd String/Vector behavior Pin
toxcct19-Sep-08 7:07
toxcct19-Sep-08 7:07 
David, i'm sorry to say that I don't reproduce that (as expected, thanksfully)...

System.out.println(m.m_strAge.length()) gives me 0 (not "", because you're doing a length() on it)...

here is my exact code:
main.java:
 
package test;
import java.util.Vector;
 
public class Main {
    public static void main(String[] args) {
    Vector<MyClass> vect = new Vector<MyClass>();
 
        vect.add(new MyClass());
 
        MyClass m = vect.get(0);
        System.out.println(m.m_strName.length());
        System.out.println(m.m_strAge.length());
 
        System.out.println("");  //easy hack to place a breakpoint at the end :)
    }
}

MyClass.java
 
package test;
 
public class MyClass {
    public String m_strName;
    public String m_strAge;
 
    public MyClass() {
        m_strName = "David";
        m_strAge = "";
    }
}


the Output of the debug console is:
5
0


So the question that comes to my mind : what compiler (IDE ?) do you use ?

ps: you code smells like a C++ coder is behind this ^^ (the m_ is not kinda java habits)


GeneralRe: Odd String/Vector behavior Pin
David Crow19-Sep-08 7:15
David Crow19-Sep-08 7:15 
Questionhow to send live recording audio Pin
manju23reddy17-Sep-08 21:17
manju23reddy17-Sep-08 21:17 
Questionsimple web cam chat application Pin
Matthew Dally17-Sep-08 17:12
Matthew Dally17-Sep-08 17:12 
QuestionDownloading Bank Account Info... Pin
bane7313-Sep-08 7:36
bane7313-Sep-08 7:36 
QuestionSwing:JDialog Pin
shwetabhas12-Sep-08 10:21
shwetabhas12-Sep-08 10:21 
AnswerRe: Swing:JDialog Pin
toxcct14-Sep-08 22:10
toxcct14-Sep-08 22:10 
QuestionSSN Validation Pin
Sudheer.kumarmatta9-Sep-08 20:16
Sudheer.kumarmatta9-Sep-08 20:16 
Questionproblem in bluetooth programming in java Pin
manju23reddy8-Sep-08 20:09
manju23reddy8-Sep-08 20:09 
QuestionAbstract Data Types Pin
Kevin Marois8-Sep-08 16:51
professionalKevin Marois8-Sep-08 16:51 
AnswerRe: Abstract Data Types Pin
toxcct8-Sep-08 21:05
toxcct8-Sep-08 21:05 
GeneralRe: Abstract Data Types Pin
Kevin Marois10-Sep-08 8:37
professionalKevin Marois10-Sep-08 8:37 
GeneralRe: Abstract Data Types Pin
toxcct10-Sep-08 9:16
toxcct10-Sep-08 9:16 
AnswerRe: Abstract Data Types Pin
Reagan Conservative18-Sep-08 11:42
Reagan Conservative18-Sep-08 11:42 
QuestionSession problem Pin
Mogaambo1-Sep-08 20:01
Mogaambo1-Sep-08 20:01 
AnswerRe: Session problem Pin
tiantian_hello23-Sep-08 15:17
tiantian_hello23-Sep-08 15:17 
QuestionJAVA and J2EE Pin
pearlugi28-Aug-08 23:37
pearlugi28-Aug-08 23:37 
AnswerRe: JAVA and J2EE Pin
toxcct1-Sep-08 19:25
toxcct1-Sep-08 19:25 

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.