Results 1 to 4 of 4
  1. #1
    Miky-Maous is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Unhappy Exception in thread "main" java.lang.NullPointerException

    I would like some help with this code i wrote whick keeps bringing me the same error msg, thx in advance:
    Exception in thread "main" java.lang.NullPointerException
    at myproject.Main.epilogiastheni(Main.java:163)
    at myproject.Main.allagistoixeiwn(Main.java:220)
    at myproject.Main.main(Main.java:758)
    Java Result: 1

    With this message my program doesnt let me to alter the elements of astheneis when i store them.

    CODE:
    Java Code:
    package myproject;
    import java.io.*;
    import java.text.SimpleDateFormat;
    import java.util.*;
    public class Main
    {
    static Vector giatroi;
    static Vector grammateis;
    static Vector astheneis;
    static Vector imerologio;
    static Vector exoplismoi;
    static Iterator it;
    static Iterator it1;
    static Iterator it2;
    static Iterator it3;
    static Iterator it4;
    static Programma current;
    static FileOutputStream fos = null;
    static FileInputStream fis = null;
    static ObjectOutputStream out = null;
    static ObjectInputStream Oin = null;
    static BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    static int num;
    static int codex;
    static int codexx;
    static Exetasi a;
    static Asthenis q;
    static Grammateas h;
    static Giatros g;
    static Exoplismos exoplismos;
    static Programma programma;
    private static void diathesimosexoplismos() throws IOException
    {
    if(exoplismoi.size() == 0)
    {
    System.out.println("Den yparxei exoplismos");
    return;
    }
    System.out.println("Idou o diathesimos exoplismos pou diatithetai:");
    int option = 0;
    int k = 0;
    boolean flag=false;
    for(int i=0;i<exoplismoi.size();i++)
    {
    System.out.print(++k + ".");
    exoplismos = (Exoplismos)exoplismoi.get(i);
    exoplismos.ShowOnoma();
    System.out.println("Kwdikas exoplismou" + exoplismos.GetCode());
    }
    do
    {
    System.out.println("Dwste thn epilogi sas");
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.out.println("Lathos epilogi");
    continue;
    }
    if(option <= 0 || option > exoplismoi.size())
    System.out.println("Lathos epilogi");
    } 
    while(option <= 0 || option > exoplismoi.size());
    exoplismos = (Exoplismos)exoplismoi.get(option - 1);
    int onoma = exoplismos.GetOnoma();
    int code = exoplismos.GetCode();
    System.out.println("O exoplismos aytos xrisimopoieitai");
    for(int i = 0; i < imerologio.size(); i++)
    {
    programma = (Programma)imerologio.get(i);
    if(programma.GetExetasi() == onoma && programma.GetCode() == code)
    {
    SimpleDateFormat formatter = new SimpleDateFormat("E dd.MM.yyyy");
    System.out.println(formatter.format(programma.getDate()));
    flag=true;
    }
    }
    if(flag==false)
    {
    System.out.println("Den exei programmatistei exetasi me xrisi tou sigekrimenou exoplismou.");
    }
    }
    private static void programma() throws IOException
    {
    SimpleDateFormat formatter = new SimpleDateFormat("E dd.MM.yyyy");
    Calendar cal = Calendar.getInstance();
    cal.set(11, 0);
    cal.set(12, 0);
    cal.set(13, 0);
    cal.set(14, 0);
    String next = "next";
    String previous = "pre";
    String exit = "exit";
    String c = null;
    do
    {
    int k = 0;
    if(cal.get(7) != 7 && cal.get(7) != 1)
    {
    int i = 0;
    do
    {
    if(i >= imerologio.size())
    break;
    programma = (Programma)imerologio.get(i);
    if(programma.getDate().compareTo(cal.getTime()) == 0)
    {
    a = (Exetasi)astheneis.get(programma.GetNum() - 1);
    System.out.println("Hmeromhnia:" + formatter.format(programma.getDate()));
    System.out.println("Onomatepwnymo:" + a.GetOnoma()+ " " + a.GetEpitheto());
    System.out.print("EXETASI:");
    programma.ShowExetasi();
    if(programma.GetCode() != 4)
    System.out.println("Kwdikos exoplismou:" + programma.GetCode());
    k = 1;
    break;
    }
    i++;
    }
    while(true);
    if(k == 0)
    {
    System.out.println("Hmeromhnia:" + formatter.format(cal.getTime()));
    System.out.println("Den yparxei programma gia aytin ti mera.");
    }
    }
    else
    {
    System.out.println("Hmeromhnia:"+formatter.format(cal.getTime()));
    System.out.println("To diagnwstiko kentro den leitourgei logw kalokairinwn diakopwn.");
    }
    System.out.println("pre,next,exit");
    c = in.readLine();
    if(next.equals(c))
    cal.add(6, 1);
    else if(previous.equals(c))
    {
    cal.add(6, -1);
    }
    else
    {
    if(exit.equals(c))
    return;
    System.err.println("Lathos epilogh");
    }
    }
    while(true);
    }
    private static int epilogiastheni() throws IOException
    {
    if(astheneis.size() == 0)
    {
    System.out.println("Den exoun kataxwrithei astheneis");
    return 0;
    }
    System.out.println("Epilekste asthenh");
    int option = 0;
    for(int i=0;i<astheneis.size();i++)
    {
    q = (Asthenis)astheneis.get(i);
    System.out.println(a.GetNum()+"."+a.GetOnoma()+ " " +a.GetEpitheto());
    }
    do
    {
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.out.println("Lathos epilogh");
    continue;
    }
    if(option <= 0 || option > astheneis.size())
    System.out.println("Lathos epilogh");
    }
    while(option <= 0 || option > astheneis.size());
    return option;
    }
    private static void istoriko()  throws IOException
    {
    int asthenis = epilogiastheni();
    if(asthenis == 0)
    return;
    a = (Exetasi)astheneis.get(asthenis - 1);
    if(a.GetExetasi() == 0)
    {
    System.out.println("Den yparxei programmatismeni exetasi gia ton astheni.");
    return;
    }
    System.out.println("Exetasi:" + a.GetExetasi());
    System.out.print("Exetasi:");
    a.GetExetasi();
    a.ShowExetasi();
    System.out.println("p:" + a.GetExetasi() +a.GetP());
    a.GetExetasi();
    a.showDates();
    System.out.println("Plhktrologhste yes gia dimiourgia tou istorikou i no gia akyrwsh.");
    String yes = "yes";
    String no = "no";
    for(String c = null; !yes.equals(c) && !no.equals(c);)
    {
    c = in.readLine();
    if(c.equals(yes))
    {
    a.SetExetasi(0);
    System.out.println("Oloklirwsi kataxwrisis istorikou");
    } 
    else
    if(c.equals(no))
    System.out.println("Epistrofh sto kedriko menou");
    else
    System.err.println("Lathos epilogh");
    }
    }
    private static void allagistoixeiwn() throws IOException
    {
    int asthenis = epilogiastheni();
    if(asthenis == 0)
    return;
    int i;
    i = 0;
    do
    {
    if(i >= astheneis.size())
    break;
    q = (Asthenis)astheneis.get(i);
    if(q.GetNum() == asthenis)
    break;
    i++;
    }
    while(true);
    System.out.println("Poio stoixeio epitheimeite na allaxete;:");
    int option = 0;
    do
    {
    System.out.println("1.Onoma:" + q.GetOnoma());
    System.out.println("2.Epitheto:" + q.GetEpitheto());
    System.out.println("3.Dieuthinsi:" + q.GetDieythinsi());
    System.out.println("4.Tilefwno:" + q.GetTilefwno());
    System.out.println("5.Asfalistikos foreas:" + q.GetForeas());
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.err.println("Lathos epilogh");
    continue;
    }
    if(option != 1 && option != 2 && option != 3 && option != 4 && option != 5)
    System.err.println("Lathos epilogh");
    }
    while(option != 1 && option != 2 && option != 3 && option != 4 && option != 5);
    switch(option)
    {
    case 1:
    {
    System.out.print("Onoma:");
    String edit = in.readLine();
    q.SetOnoma(edit);
    break;
    }
    case 2:
    {
    System.out.print("Epitheto:");
    String edit = in.readLine();
    q.SetEpitheto(edit);
    break;
    }
    case 3:
    {
    System.out.print("Dieythinsi:");
    String edit = in.readLine();
    q.SetDieythinsi(edit);
    break;
    }
    case 4:
    {
    System.out.print("Tilefwno:");
    String edit = in.readLine();
    q.SetTilefwno(edit);
    break;
    }
    case 5:
    {
    System.out.print("Asfalistikos foreas:");
    String edit = in.readLine();
    q.SetForeas(edit);
    break;
    }
    }
    astheneis.set(i, q);
    System.out.println("H diorthwsh oloklhrwthike.");
    }
    private static int epilogiexoplismou(int exetasi)  throws IOException
    {
    System.out.println("Epilekste kwdiko exoplismou:");
    int kwdikos = 0;
    it3 = exoplismoi.iterator();
    do
    {
    if(!it3.hasNext())
    break;
    exoplismos = (Exoplismos)it3.next();
    if(exoplismos.GetOnoma() == exetasi)
    {
    System.out.println("Kwdikos:" + exoplismos.GetCode());
    kwdikos = exoplismos.GetCode();
    }
    } 
    while(true);
    if(kwdikos == 0)
    {
    System.out.println("Den yparxei exoplismos gia ti sigekrimeni exetasi.");
    return 0;
    }
    int option = 0;
    do
    {
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.err.println("Lathos epilogh");
    continue;
    }
    if(option < 0 || option > kwdikos)
    System.err.println("Lathos epilogh");
    }
    while(option <= 0 || option > kwdikos);
    return option;
    }
    private static void kataxwrisiexoplismou() throws IOException
    {
    System.out.println("Epilekste exoplismo:");
    int option = 0;
    do
    {
    System.out.println("1---->Magnitikos tomografos");
    System.out.println("2---->Axonikos tomografos");
    System.out.println("3---->Exoplismos iperixou");
    System.out.println("4---->Exoplismos aktinografiwn");
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.err.println("Lathos epilogh");
    continue;
    }
    if(option != 1 && option != 2 && option != 3 && option != 4)
    System.err.println("Lathos epilogh");
    }
    while(option != 1 && option != 2 && option != 3 && option != 4);
    int code = 0;
    it3 = exoplismoi.iterator();
    do
    {
    if(!it3.hasNext())
    break;
    exoplismos = (Exoplismos)it3.next();
    if(exoplismos.GetOnoma() == option)
    code = exoplismos.GetCode();
    }
    while(true);
    code++;
    exoplismos = new Exoplismos();
    exoplismos.SetOnoma(option);
    exoplismos.SetCode(code);
    exoplismoi.add(exoplismos);
    System.out.println("Termatismos kataxwrisis. Kwdikos exoplismou:" + code);
    }
    private static int MenouExetasewn() throws IOException
    {
    System.out.println("EXETASEIS");
    int option = 0;
    do
    {
    System.out.println("1.Aimatologikes");
    System.out.println("2.Ourologikes");
    System.out.println("3.Ginaikologikes");
    System.out.println("4.Tomografies kai aktinologia");
    System.out.println("Epilexate:");
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.err.println("Lathos epilogh");
    continue;
    }
    if(option != 1 && option != 2 && option != 3 && option != 4)
    System.err.println("Lathos epilogh");
    }
    while(option != 1 && option != 2 && option != 3 && option != 4);
    return option;
    }
    private static int p() throws IOException
    {
    int option = 0;
    do
    {
    System.out.println("Dwste th epilogh sas:");
    try
    {
    option = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.err.println("Lathos epilogh");
    continue;
    }
    if(option != 1 && option != 2 && option != 3)
    System.err.println("Lathos epilogh");
    }
    while(option != 1 && option != 2 && option != 3);
    return option;
    }
    private static void programmatismosexetasewn() throws IOException
    {
    int asthenis = epilogiastheni();
    if(asthenis == 0)
    return;
    a = (Exetasi)astheneis.get(asthenis - 1);
    if(a.GetExetasi() != 0)
    {
    System.out.println("Yparxei idi kanonismeni exetasi gia ton asthenh");
    return;
    }
    MenouExetasewn();
    int y = MenouExetasewn();
    int code = 4;
    if(y != 4)
    code = epilogiexoplismou(y);
    if(code == 0)
    return;
    System.out.println("Dwste ton arithmo exetasewn p");
    int p = p();
    Date dates[] = new Date[p];
    int i = 0;
    do
    {
    if(i >= p)
    break;
    int k = 0;
    Calendar cal = Calendar.getInstance();
    cal.set(11, 0);
               
    cal.set(12, 0);
    cal.set(13, 0);
    cal.set(14, 0);
    if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY)
    cal.add(6, 2);
    if(cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
    cal.add(7, 1);
    while(k != 1)
    {
    String c = null;
    String ok = "ok";
    String next = "next";
    int x = 0;
    it3 = imerologio.iterator();
    do
    {
    if(!it3.hasNext())
    break;
    programma = (Programma)it3.next();
    if(programma.getDate().compareTo(cal.getTime()) != 0)
    continue;
    x = 1;
    break;
    }
    while(true);
    if(x == 1)
    {
    cal.add(6, 1);
    if(cal.get(7) == 7)
    cal.add(7, 2);
    }
    else
    {
    SimpleDateFormat formatter = new SimpleDateFormat("E dd.MM.yyyy");
    System.out.println(formatter.format(cal.getTime()));
    while(!next.equals(c) && !ok.equals(c))
    {
    System.out.println("Plhktrologhste ok gia desmeysi ths sygekrimenhs imeromhnias i next " + "gia na deite thn epomeni diathesimi.");
    c = in.readLine();
    if(c.equals(ok))
    {
    System.out.println("H imerominia desmeytike.");
    programma = new Programma();
    programma.SetNum(asthenis);
    programma.SetExetasi(y);
    programma.SetCode(code);
    programma.setDate(cal.getTime());
    dates[i] = cal.getTime();
    imerologio.add(programma);
    programma = null;
    k = 1;
    }
    else
    if(c.equals(next))
    {
    cal.add(6, 1);
    if(cal.get(7) == 7)
    cal.add(6, 2);
    }
    else
    {
    System.err.println("Lathos epilogh");
    }
    }
    }
    }
    i++;
    }
    while(true);
    i = 0;
    do
    {
    if(i >= astheneis.size())
    break;
    a = (Exetasi)astheneis.get(i);
    if(a.GetNum() == asthenis)
    {
    Exetasi exetasi = new Exetasi();
    exetasi.SetExetasi(y);
    exetasi.SetP(p);
    exetasi.OrismosImerominias(dates);
    astheneis.set(i, a);
    break;
    }
    i++;
    }
    while(true);
    System.out.println("To programma ths therapeias kathoristhke.");
    }
    private static void kataxwrisiastheni() throws IOException
    {
    System.out.println("Dwse to onoma tou astheni:");
    String onoma = in.readLine();
    System.out.println("Dwse to epitheto tou astheni:");
    String epitheto = in.readLine();
    System.out.println("Dwse to tilefwno tou astheni:");
    String tilefwno = in.readLine();
    System.out.println("Dwse ti dieythinsi tou astheni:");
    String dieythinsi = in.readLine();
    System.out.println("Dwse ton asfalistiko forea tou astheni:");
    String foreas = in.readLine();
    q = new Asthenis();
    q.SetStoixeia(onoma,epitheto,tilefwno,dieythinsi,foreas,++num);
    astheneis.addElement(q);
    }
    @SuppressWarnings("empty-statement")
    private static void kataxwrisigiatrou() throws IOException
    {
    System.out.println("Dwse to onoma tou giatrou:");
    String onoma = in.readLine();
    System.out.println("Dwse to epitheto tou giatrou:");
    String epitheto = in.readLine();
    g = new Giatros();
    g.SetStoixeia(onoma,epitheto,++codex);
    giatroi.addElement(g);
    }
    @SuppressWarnings("empty-statement")
    private static void kataxwrisigrammatea() throws IOException
    {
    System.out.println("Dwse to onoma tou grammatea:");
    String onoma = in.readLine();
    System.out.println("Dwse to epitheto tou grammatea:");
    String epitheto = in.readLine();
    h = new Grammateas();
    h.SetStoixeia(onoma,epitheto,++codexx);
    grammateis.addElement(h);
    }
    @SuppressWarnings("empty-statement")
    public static void main(String args[]) throws IOException, ClassNotFoundException
    {
    Locale.setDefault(Locale.ENGLISH);
    Calendar cal = Calendar.getInstance();
    cal.set(11, 0);
    cal.set(12, 0);
    cal.set(13, 0);
    cal.set(14, 0);
    SimpleDateFormat formatter = new SimpleDateFormat("E dd.MM.yyyy");
    System.out.println(formatter.format(cal.getTime()));
    imerologio = new Vector();
    try
    {
    fis = new FileInputStream("imerologio");
    Oin = new ObjectInputStream(fis);
    boolean flag=false;
    try
    {
    do
    {
    Programma eggr = (Programma)Oin.readObject();
    imerologio.addElement(eggr);
    flag=true;
    }
    while(true);
    }
    catch(EOFException endOfFileException)
    {
    if(flag==false) System.out.println("Den iparxei programma");
    Oin.close();
    
    }
    }
    catch(FileNotFoundException fileNotFoundException)
    {
    System.out.println("Den iparxei programma");
    }
    giatroi = new Vector();
    try
    {
    fis = new FileInputStream("giatroi");
    Oin = new ObjectInputStream(fis);
    try
    {
    do
    {
    g = (Giatros)Oin.readObject();
    giatroi.addElement(g);
    } 
    while(true);
    }
    catch(EOFException endOfFileException)
    {
    Oin.close();
    }
    }
    catch(FileNotFoundException fileNotFoundException)
    {
    }
    if(giatroi.size() == 0)
    {
    codex=0;
    System.out.println("Den iparxoun kataxwrimenoi giatroi");
    }
    else
    codex = ((Giatros)giatroi.lastElement()).GetCodex();
    grammateis = new Vector();
    try
    {
    fis = new FileInputStream("grammateis");
    Oin = new ObjectInputStream(fis);
    try
    {
    do
    {
    h = (Grammateas)Oin.readObject();
    grammateis.addElement(h);
    } 
    while(true);
    }
    catch(EOFException endOfFileException)
    {
    Oin.close();
    }
    }
    catch(FileNotFoundException fileNotFoundException)
    {
    }
    if(grammateis.size() == 0)
    {
    codexx=0;
    System.out.println("Den iparxoun kataxwrimenoi grammateis");
    }
    else
    codexx = ((Grammateas)grammateis.lastElement()).GetCodexx();
    astheneis = new Vector();
    try
    {
    fis = new FileInputStream("astheneis");
    Oin = new ObjectInputStream(fis);
    try
    {
    do
    {
    q = (Asthenis)Oin.readObject();
    astheneis.addElement(q);
    } 
    while(true);
    }
    catch(EOFException endOfFileException)
    {
    Oin.close();
    }
    }
    catch(FileNotFoundException fileNotFoundException)
    {
    }
    if(astheneis.size() == 0)
    {
    num=0;
    System.out.println("Den iparxoun kataxwrimenoi astheneis");
    }
    else
    num = ((Asthenis)astheneis.lastElement()).GetNum();
    exoplismoi = new Vector();
    try
    {
    fis = new FileInputStream("exoplismoi");
    Oin = new ObjectInputStream(fis);
    try
    {
    do
    {
    exoplismos = (Exoplismos)Oin.readObject();
    exoplismoi.addElement(exoplismos);
    }
    while(true);
    }
    catch(EOFException endOfFileException)
    {
    Oin.close();
    }
    }
    catch(FileNotFoundException fileNotFoundException)
    {
    }
    if(exoplismoi.size()==0)
    System.out.println("Den iparxei kataxwrimenos exoplismos");
    int epilogi=0;
    do
    {
    System.out.println("Menou ipiresiwn diagnwstikou kentrou.");
    System.out.println("1.Kataxwrish kai eisagwgi stoixeiwn asthenh");
    System.out.println("2.Tropopoiisi stoixeiwn astheni");
    System.out.println("3.Kataxwrisi giatrou");
    System.out.println("4.Kataxwrisi grammatea");
    System.out.println("5.Exoplismos pou diatithetai");
    System.out.println("6.Kataxwrisi exoplismou");
    System.out.println("7.Programmatismos exetasewn");
    System.out.println("8.Ektipwsi programmatismenwn exetasewn");
    System.out.println("9.Dimiourgia istorikou exetasis");
    System.out.println("0.Exodos");
    System.out.println("Dwste thn epilogh sas:");
    try
    {
    epilogi = Integer.parseInt(in.readLine());
    }
    catch(NumberFormatException ne)
    {
    System.err.println("Lathos epilogh");
    epilogi = 1;
    continue;
    }
    if(epilogi==1) kataxwrisiastheni();
    else if(epilogi==2) allagistoixeiwn();
    else if(epilogi==3) kataxwrisigiatrou();
    else if(epilogi==4) kataxwrisigrammatea();
    else if(epilogi==5) diathesimosexoplismos();
    else if(epilogi==6) kataxwrisiexoplismou();
    else if(epilogi==7) programmatismosexetasewn();
    else if(epilogi==8) programma();
    else if(epilogi==9) istoriko();
    else if(epilogi==0) System.out.println("Termatismos ipiresias");
    else System.err.println("Parakalw pliktrologiste mia apo tis diathesimes epiloges");
    }
    while(epilogi != 0);
    fos = new FileOutputStream("giatroi");
    out = new ObjectOutputStream(fos);
    for(it = giatroi.iterator(); it.hasNext(); out.writeObject(it.next()));
    out.close();
    fos = new FileOutputStream("grammateis");
    out = new ObjectOutputStream(fos);
    for(it1 = grammateis.iterator(); it1.hasNext(); out.writeObject(it1.next()));
    out.close();
    fos = new FileOutputStream("astheneis");
    out = new ObjectOutputStream(fos);
    for(it2 = astheneis.iterator(); it2.hasNext(); out.writeObject(it2.next()));
    out.close();
    fos = new FileOutputStream("exoplismoi");
    out = new ObjectOutputStream(fos);
    for(it3 = exoplismoi.iterator(); it3.hasNext(); out.writeObject(it3.next()));
    out.close();
    fos = new FileOutputStream("imerologio");
    out = new ObjectOutputStream(fos);
    for(it4 = imerologio.iterator(); it4.hasNext(); out.writeObject(it4.next()));
    out.close();
    }
    }
    
    class Asthenis:
    
    package myproject;
    public class Asthenis 
    {
    private String onoma;
    private String epitheto;
    private String tilefwno;
    private String dieythinsi;
    private String foreas;
    private int num;
    public Asthenis(){};
    public Asthenis(String onoma,String epitheto,String tilefwno,String dieythinsi,String foreas,int num)
    {
    this.onoma=onoma;
    this.epitheto=epitheto;
    this.tilefwno=tilefwno;
    this.dieythinsi=dieythinsi;
    this.foreas=foreas;
    this.num=num;
    }
    public void SetStoixeia(String onoma,String epitheto,String tilefwno,String dieythinsi,String foreas,int num)
    {
    this.onoma=onoma;
    this.epitheto=epitheto;
    this.tilefwno=tilefwno;
    this.dieythinsi=dieythinsi;
    this.foreas=foreas;
    this.num=num;
    }
    public void SetOnoma(String onoma)
    {
    this.onoma=onoma;
    }
    public void SetEpitheto(String epitheto)
    {
    this.epitheto=epitheto;
    }
    public void SetTilefwno(String tilefwno)
    {
    this.tilefwno=tilefwno;
    }
    public void SetDieythinsi(String dieythinsi)
    {
    this.dieythinsi=dieythinsi;
    }
    public void SetForeas(String foreas)
    {
    this.foreas=foreas;
    }
    public String GetOnoma()
    {
    return onoma;
    }
    public String GetEpitheto()
    {
    return epitheto;
    }
    public String GetTilefwno()
    {
    return tilefwno;
    }
    public String GetDieythinsi()
    {
    return dieythinsi;
    }
    public String GetForeas()
    {
    return foreas;
    }
    public int GetNum()
    {
    return num;
    }
    }
    Last edited by Fubarable; 08-20-2009 at 04:17 PM. Reason: code tags added, but the code was pasted unformatted

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    837
    Rep Power
    6

    Default

    Hi,
    Nobody will have patience to read this much big code.

    Not even a single comment u put.Put exception block and try to print the exception properly,

    As per the stack trace,i can say error in Main class in this below SOP

    System.out.println(a.GetNum()+"."+a.GetOnoma()+ " " +a.GetEpitheto());

    I think "Exetasi" class reference is pointing to null.Please go ahead and put some exception block in the above class.
    Ramya:cool:

  3. #3
    Miky-Maous is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Default Problem solved...!!!

    You are right... so sorry about my post but its just that i suck at java programming it took me weeks to make this program so far and 3-4 books by my side too. Regardless of that though u found the problem (in line 163 a must be q) so thx so much i will try to put some comments too :) Again thx so much for help!

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Hello Miky, and welcome to the Forum! I'm glad that Ramy was able to help you. If I could make one more suggestion (other than the great suggestion already made to try to limit the amount of code posted to one page or so -- an amount appropriate to ask a volunteer to look at), please also post your code already formatted (yours is all left justified) and use code tags. If you do this, your code will be much more readable. The forum FAQ will explain all about code tags.
    For instance, here is your last class posted with tags:
    Java Code:
    class Asthenis {
      private String onoma;
      private String epitheto;
      private String tilefwno;
      private String dieythinsi;
      private String foreas;
      private int num;
    
      public Asthenis() {
      };
    
      public Asthenis(String onoma, String epitheto, String tilefwno,
          String dieythinsi, String foreas, int num) {
        this.onoma = onoma;
        this.epitheto = epitheto;
        this.tilefwno = tilefwno;
        this.dieythinsi = dieythinsi;
        this.foreas = foreas;
        this.num = num;
      }
    
      public void SetStoixeia(String onoma, String epitheto, String tilefwno,
          String dieythinsi, String foreas, int num) {
        this.onoma = onoma;
        this.epitheto = epitheto;
        this.tilefwno = tilefwno;
        this.dieythinsi = dieythinsi;
        this.foreas = foreas;
        this.num = num;
      }
    
      public void SetOnoma(String onoma) {
        this.onoma = onoma;
      }
    
      public void SetEpitheto(String epitheto) {
        this.epitheto = epitheto;
      }
    
      public void SetTilefwno(String tilefwno) {
        this.tilefwno = tilefwno;
      }
    
      public void SetDieythinsi(String dieythinsi) {
        this.dieythinsi = dieythinsi;
      }
    
      public void SetForeas(String foreas) {
        this.foreas = foreas;
      }
    
      public String GetOnoma() {
        return onoma;
      }
    
      public String GetEpitheto() {
        return epitheto;
      }
    
      public String GetTilefwno() {
        return tilefwno;
      }
    
      public String GetDieythinsi() {
        return dieythinsi;
      }
    
      public String GetForeas() {
        return foreas;
      }
    
      public int GetNum() {
        return num;
      }
    }
    and without tags:
    class Asthenis {
    private String onoma;
    private String epitheto;
    private String tilefwno;
    private String dieythinsi;
    private String foreas;
    private int num;

    public Asthenis() {
    };

    public Asthenis(String onoma, String epitheto, String tilefwno,
    String dieythinsi, String foreas, int num) {
    this.onoma = onoma;
    this.epitheto = epitheto;
    this.tilefwno = tilefwno;
    this.dieythinsi = dieythinsi;
    this.foreas = foreas;
    this.num = num;
    }

    public void SetStoixeia(String onoma, String epitheto, String tilefwno,
    String dieythinsi, String foreas, int num) {
    this.onoma = onoma;
    this.epitheto = epitheto;
    this.tilefwno = tilefwno;
    this.dieythinsi = dieythinsi;
    this.foreas = foreas;
    this.num = num;
    }

    public void SetOnoma(String onoma) {
    this.onoma = onoma;
    }

    public void SetEpitheto(String epitheto) {
    this.epitheto = epitheto;
    }

    public void SetTilefwno(String tilefwno) {
    this.tilefwno = tilefwno;
    }

    public void SetDieythinsi(String dieythinsi) {
    this.dieythinsi = dieythinsi;
    }

    public void SetForeas(String foreas) {
    this.foreas = foreas;
    }

    public String GetOnoma() {
    return onoma;
    }

    public String GetEpitheto() {
    return epitheto;
    }

    public String GetTilefwno() {
    return tilefwno;
    }

    public String GetDieythinsi() {
    return dieythinsi;
    }

    public String GetForeas() {
    return foreas;
    }

    public int GetNum() {
    return num;
    }
    }


    Much luck!
    Last edited by Fubarable; 08-20-2009 at 04:23 PM.

Similar Threads

  1. Replies: 6
    Last Post: 07-16-2009, 03:30 PM
  2. Replies: 1
    Last Post: 07-16-2009, 10:35 AM
  3. Exception in thread "main" java.lang.NullPointerException
    By farooqhussain786 in forum New To Java
    Replies: 10
    Last Post: 04-03-2009, 06:31 AM
  4. Replies: 1
    Last Post: 02-17-2009, 10:54 AM
  5. Replies: 1
    Last Post: 07-16-2007, 06:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •