Click here to Skip to main content
15,913,939 members
Home / Discussions / Java
   

Java

 
AnswerRe: Calling a Shared function from the Client side Pin
Richard MacCutchan27-Jan-12 7:11
mveRichard MacCutchan27-Jan-12 7:11 
GeneralRe: Calling a Shared function from the Client side Pin
Vimalsoft(Pty) Ltd28-Jan-12 4:00
professionalVimalsoft(Pty) Ltd28-Jan-12 4:00 
Questionbe project Pin
harendra rai26-Jan-12 19:38
harendra rai26-Jan-12 19:38 
AnswerRe: be project Pin
TorstenH.26-Jan-12 20:44
TorstenH.26-Jan-12 20:44 
Questionjpanel to itext Pin
bijalvadher24-Jan-12 23:32
bijalvadher24-Jan-12 23:32 
AnswerRe: jpanel to itext Pin
Nagy Vilmos25-Jan-12 2:23
professionalNagy Vilmos25-Jan-12 2:23 
AnswerRe: jpanel to itext Pin
TorstenH.25-Jan-12 3:04
TorstenH.25-Jan-12 3:04 
QuestionProblem with ArrayLists java Pin
nikosv21-Jan-12 21:04
nikosv21-Jan-12 21:04 
<pre> Hello

i want to implement a central weather station( is the class KentrikosMeteorologikosStathmos) where you can add or remove regional weather stations. In the regional station(is the classPeriferiakosMeterologikosStathmos) you can add or remove sensors . There are 3 kinds of sensors SensorAnemou, SensorVroxis and SensorFoteinotitas
When i compile the programm it shows

java.lang.NoClassDefFoundError:
Caused by: java.lang.ClassNotFoundException:

thanks

</pre>

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author ΝΙΚΟΣ
*/
import java.util.ArrayList;
public class KentrikosMeteorologikosStathmos {
String poli;
private ArrayList<PeriferiakosMeterologikosStathmos> p;

public void addPeriferiakos()
{
p=new ArrayList<PeriferiakosMeterologikosStathmos>();
}
public void removePeriferiakos()
{
int i=p.indexOf(p);

if(i>=0){
p.remove(i);
}
}
public void collectPerif()
{
ArrayList<PeriferiakosMeterologikosStathmos> per=new ArrayList<PeriferiakosMeterologikosStathmos>();
for(PeriferiakosMeterologikosStathmos var)
per.add(var);

System.out.println("Periferiakoi");
for(int count=0;count<per.size();count++)
System.out.println(per.get(count));
}




}






/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author ΝΙΚΟΣ
*/
import java.util.ArrayList;

public class PeriferiakosMeterologikosStathmos {
private ArrayList<Sensor> o;
public PeriferiakosMeterologikosStathmos()
{
o=new ArrayList<Sensor>();
}

public void addSensor(Sensor s)
{
//ArrayList<Sensor> o=new ArrayList();
o.add(s);
}
public void removeSensor(ArrayList<Sensor> s)
{

int i=o.indexOf(o);
if(i>=0){
o.remove(i);
}
}
public void collectSensors()
{

ArrayList<Sensor> sens=new ArrayList<Sensor>();
for(Sensor var)
sens.add(var);

System.out.println("Sensores");
for(int count=0;count<sens.size();count++)
System.out.println(sens.get(count));
}


}



/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/



/**
*
* @author ΝΙΚΟΣ
*/

public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
KentrikosMeteorologikosStathmos s=new KentrikosMeteorologikosStathmos();

s.collectPerif();






}

}





import java.util.Random;
public class SensorVroxis extends Sensor {
@Override
public double getValue()
{
Random r=new Random();
int d;
d=r.nextInt(10);
return d;
}

}




import java.util.Random;
public class SensorAnemou extends Sensor {

public double getValue()
{
double d;
Random r=new Random();
int meters=r.nextInt();
int seconds=r.nextInt();
d=r.nextInt(meters/seconds);
return d;
}

}


import java.util.Random;
public class SensorFoteinotitas {
Random r=new Random();
public double getValue()
{
double d;
double cov=r.nextInt();
d=cov/100;
return d;


}

}




import java.util.Random;
public abstract class Sensor {


public abstract double getValue();



}
AnswerRe: Problem with ArrayLists java Pin
Richard MacCutchan21-Jan-12 23:05
mveRichard MacCutchan21-Jan-12 23:05 
QuestionHelp with adding jPanel Form to other form Pin
_T("No name")21-Jan-12 5:53
_T("No name")21-Jan-12 5:53 
AnswerRe: Help with adding jPanel Form to other form Pin
TorstenH.22-Jan-12 21:42
TorstenH.22-Jan-12 21:42 
QuestionMultithreaded proxy server Pin
prateek.rajan8919-Jan-12 16:29
prateek.rajan8919-Jan-12 16:29 
AnswerRe: Multithreaded proxy server Pin
Peter_in_278019-Jan-12 17:41
professionalPeter_in_278019-Jan-12 17:41 
AnswerRe: Multithreaded proxy server Pin
jschell20-Jan-12 12:49
jschell20-Jan-12 12:49 
Questioncode problem Pin
nikhil_kumar19-Jan-12 11:04
nikhil_kumar19-Jan-12 11:04 
AnswerRe: code problem Pin
TorstenH.19-Jan-12 21:34
TorstenH.19-Jan-12 21:34 
GeneralRe: code problem Pin
nikhil_kumar21-Jan-12 9:10
nikhil_kumar21-Jan-12 9:10 
GeneralRe: code problem Pin
♥…ЯҠ…♥12-Feb-12 17:41
professional♥…ЯҠ…♥12-Feb-12 17:41 
AnswerRe: code problem Pin
♥…ЯҠ…♥12-Feb-12 17:14
professional♥…ЯҠ…♥12-Feb-12 17:14 
Questionsource code Pin
bhanu.pratap.9918-Jan-12 2:46
bhanu.pratap.9918-Jan-12 2:46 
AnswerRe: source code Pin
Richard MacCutchan18-Jan-12 3:00
mveRichard MacCutchan18-Jan-12 3:00 
AnswerRe: source code Pin
Nagy Vilmos18-Jan-12 3:03
professionalNagy Vilmos18-Jan-12 3:03 
AnswerRe: source code Pin
TorstenH.18-Jan-12 3:23
TorstenH.18-Jan-12 3:23 
AnswerRe: source code Pin
SilimSayo26-Jan-12 6:49
SilimSayo26-Jan-12 6:49 
QuestionHow to write a program in java which stores every thing i type anywhere in a file Pin
anilgoyal128915-Jan-12 18:25
anilgoyal128915-Jan-12 18: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.