Click here to Skip to main content
16,019,983 members
Home / Discussions / Java
   

Java

 
GeneralRe: Action Listener help Pin
TorstenH.14-Mar-11 23:35
TorstenH.14-Mar-11 23:35 
Questioninitialization of 3D array in java Pin
gateway2314-Mar-11 0:14
gateway2314-Mar-11 0:14 
AnswerRe: initialization of 3D array in java Pin
Luc Pattyn14-Mar-11 3:31
sitebuilderLuc Pattyn14-Mar-11 3:31 
AnswerRe: initialization of 3D array in java Pin
musefan14-Mar-11 4:23
musefan14-Mar-11 4:23 
QuestionSystem.exit is always zero Pin
Indrojeet14-Mar-11 0:08
Indrojeet14-Mar-11 0:08 
AnswerRe: System.exit is always zero Pin
Richard MacCutchan14-Mar-11 2:20
mveRichard MacCutchan14-Mar-11 2:20 
AnswerRe: System.exit is always zero Pin
jschell14-Mar-11 8:46
jschell14-Mar-11 8:46 
QuestionArray of Object Pin
future383911-Mar-11 13:11
future383911-Mar-11 13:11 
Hi, I have define the following class in my practice.
package array;
public class Student {
    
    // definition of fileds
    private int studentId= 0;
    private String name;
    private String family;

    //definition of constructor
    public Student(int _studentId, String _name, String _family){
        studentId= _studentId;
        name= _name;
        family= _family;
    }

    //definition of methods
    public int getStudentId(){
        return studentId;
    }
    public void setStudentId(int newStudentId){
        studentId= newStudentId;
    }

    public String getName(){
            return name;
    }
    public void setName(String newName){
        name= newName;
    }

    public String getFamily(){
        return family;
    }
    public void setFamily(String newFamily){
        family= newFamily;
    }
}


then in main class I have these code
package array;
import java.io.*;
import array.Student;
public class Main {

    public static void main(String[] args) {
        //define Array of Object(Student's Class)
        Student[] st = new Student[3];
        st[0]= new Student(3400,"XXX", "YYY");
        st[1]= new Student(3800, "ZZZ", "WWW");
        st[2]= new Student(4200,"RRR", "MMM");

        System.out.println(st[1]);
        System.out.println("\n");
    }
}

the problem is after I run the program nothing print out on the screen. is there problem in code??
AnswerRe: Array of Object Pin
shivamkalra11-Mar-11 19:24
shivamkalra11-Mar-11 19:24 
GeneralRe: Array of Object Pin
jschell13-Mar-11 10:02
jschell13-Mar-11 10:02 
GeneralRe: Array of Object Pin
TorstenH.13-Mar-11 23:10
TorstenH.13-Mar-11 23:10 
AnswerRe: Array of Object Pin
jschell13-Mar-11 10:06
jschell13-Mar-11 10:06 
AnswerRe: Array of Object Pin
Richard MacCutchan13-Mar-11 10:35
mveRichard MacCutchan13-Mar-11 10:35 
AnswerRe: Array of Object Pin
shi-fj31-Mar-11 4:50
shi-fj31-Mar-11 4:50 
QuestionGlassFish Pin
future383910-Mar-11 14:07
future383910-Mar-11 14:07 
AnswerRe: GlassFish Pin
TorstenH.10-Mar-11 23:12
TorstenH.10-Mar-11 23:12 
QuestionPDU to text formate Pin
coolashish7-Mar-11 20:53
coolashish7-Mar-11 20:53 
AnswerRe: PDU to text formate Pin
Richard MacCutchan7-Mar-11 22:13
mveRichard MacCutchan7-Mar-11 22:13 
AnswerRe: PDU to text formate Pin
TorstenH.8-Mar-11 23:31
TorstenH.8-Mar-11 23:31 
QuestionWeb Services Pin
sameerrede7-Mar-11 6:28
sameerrede7-Mar-11 6:28 
AnswerRe: Web Services Pin
Pravin Patil, Mumbai7-Mar-11 20:05
Pravin Patil, Mumbai7-Mar-11 20:05 
QuestionShift operations with float and double Pin
Kujtim Hyseni7-Mar-11 0:25
Kujtim Hyseni7-Mar-11 0:25 
AnswerRe: Shift operations with float and double Pin
Richard MacCutchan7-Mar-11 6:53
mveRichard MacCutchan7-Mar-11 6:53 
AnswerRe: Shift operations with float and double Pin
User 75994147-Mar-11 13:57
User 75994147-Mar-11 13:57 
AnswerRe: Shift operations with float and double Pin
David Skelly7-Mar-11 22:22
David Skelly7-Mar-11 22:22 

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.