Witam,
Mam pewien problem ale nie wiem z kąt on wynika, dostaje taki błąd:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Pair cannot be resolved to a type
Błąd jest w 11 linice w Main tam gdzie jest Array.minmax(tab)
A oto kod:
public class Main {
public static void main(String[]args){
int [] tab = new int[10];
System.out.println("Zostana wylosowane liczby: ");
for(int i=0; i<tab.length; ++i)
{
tab[i] = (int) Math.random();
}
Array.Pair p = new Array.minmax(tab);
System.out.println("Max = "+ p.getFirst());
System.out.println("Min = "+ p.getSecend());
}
}
public class Array {
public static class Pair{
public Pair(double f, double s)
{
first = f;
secend = s;
}
public double getFirst()
{
return first;
}
public double getSecend()
{
return secend;
}
}
public static Pair minmax(double [] value)
{
double min = Double.MIN_VALUE;
double max = Double.MAX_VALUE;
for(double v : value)
{
if(max < v) max = v;
if(min > v) min = v;
}
return new Pair(min, max);
}
private static double first;
private static double secend;
}
<code=java> </code>