GIDForums  

Go Back   GIDForums > Computer Programming Forums > Java Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 20-Aug-2009, 08:05
Miky-Maous Miky-Maous is offline
New Member
 
Join Date: Aug 2009
Posts: 1
Miky-Maous is on a distinguished road
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:75
Java Result: 1

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

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.getD ate()));
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,f oreas,++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 LuciWiz : 20-Aug-2009 at 09:05. Reason: Please insert your Java code between [java] & [/java] tags
  #2  
Old 20-Aug-2009, 20:56
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,140
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Exception in thread "main" java.lang.NullPointerException


There are other missing types, so we are unable to compile for verification...

Here's what I get: (after a few other 'tweaks')
Code:
Main1.java:16: error: Type `Programma' not found in declaration of field `current'. static Programma current; ^ Main1.java:25: error: Type `Exetasi' not found in declaration of field `a'. static Exetasi a; ^ Main1.java:27: error: Type `Grammateas' not found in declaration of field `h'. static Grammateas h; ^ Main1.java:28: error: Type `Giatros' not found in declaration of field `g'. static Giatros g; ^ Main1.java:29: error: Type `Exoplismos' not found in declaration of field `exoplismos'. static Exoplismos exoplismos; ^ Main1.java:30: error: Type `Programma' not found in declaration of field `programma'. static Programma programma; ^ Main1.java:532: error: Type `Exetasi' not found in the declaration of the local variable `exetasi'. Exetasi exetasi = new Exetasi(); ^ Main1.java:603: error: Type `Programma' not found in the declaration of the local variable `eggr'. Programma eggr = (Programma)Oin.readObject();
Anyway, the idea is to follow the callstack dump [from the bottom->up], that you provided earlier, and it should lead to the problem. Something must not be initialized, that's what the 'nullpointer' is all about.


EDIT:
Here's more information that might help following the callstack:

Note1: Remember, bottom->up, that's why the numbering, below, is reversed.
Note2: Also, my line# comments might be off, because a moderator had to edit your post, so you'll need to double check the lines in your editor.

3. at myproject.Main.epilogiastheni(Main.java:163)
Appears to be here:
JAVA Code:
private static int epilogiastheni() throws IOException
{
//...
System.out.println(a.GetNum()+"."+a.GetOnoma()+ " " +a.GetEpitheto());  // line 163 ??
//  [the 'a' object [type Exetasi] does NOT appear to be initialized at this point?]

2. at myproject.Main.allagistoixeiwn(Main.java:220)
Appears to be here:
JAVA Code:
private static void allagistoixeiwn() throws IOException
{
int asthenis = epilogiastheni(); // line 220 ??
if(asthenis == 0)

1. at myproject.Main.main(Main.java:758)
Appears to be here:
JAVA Code:
else if(epilogi==2) allagistoixeiwn(); // line 758 ??

That's the general idea about following the callstack.

Post another reply if needed.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
Last edited by TurboPT : 20-Aug-2009 at 21:39.
 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception in thread "main" java.lang.NullPointerException valley1girl Java Forum 12 18-Jun-2009 13:32
Exception in thread "main" java.lang.NullPointerException gedcraw555 Java Forum 3 25-Feb-2008 09:22
Exception in thread "main" java.lang.NullPointerException Magelloo Java Forum 3 06-May-2007 00:01
Thread Stopping Exception Gix .NET Forum 12 28-Nov-2006 05:30
please help in solving: Exception in thread "main" java.lang.nullpointerexception vkiran_v Java Forum 8 09-May-2006 08:06

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:01.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.