I am very new to this and the computer programming world in general, and I'm having a problem with my program and I think I'm just making one little mistake, but I can't figure out what it is! I'm using class GetStats to be the main for my other class Stats and when I compile, I get the error message: "package Stats does not exist." Can anyone help? :(

import java.util.Scanner;
import java.lang.Math;

public class Stats{

  static Scanner sc = new Scanner(System.in);

  public static int[] integers() {
    int[] num = new int[10];
    for (int i = 0 ; i < num.length ; i++){
      System.out.println("Enter an integer:");
      num[i] = sc.nextInt();
    }
    return num;
  }

  public static void minMax(int[] numbers){
    System.out.println("The min integer is " + minNum(numbers));
    System.out.println("The max integer is " + maxNum(numbers));
    System.out.println("The median is " + numbers[5]);
  }

  public static void mean(int[] numbers){
    int sum = 0;
    double average, ave, sd;
    double sum2 = 0;

    for(int i = 0; i < numbers.length; i++)
      sum += numbers[i];
    average = sum / 11;
    for(int i = 0; i < numbers.length; i++){
      sum2 += Math.pow(numbers[i] - average, 2);}
    ave = sum2 / 11;
    sd = Math.sqrt(ave);
    System.out.println("The mean of the integers is " + average);
    System.out.println("The standard deviation of the integers is " + sd);
  }

  public static int minNum(int[] numbers){
    int curr = numbers[0];
    for(int i = 0 ; i < numbers.length ; i++)
      if (numbers[i] < curr)
      curr = numbers[i];
    return curr;
  }
  public static int maxNum(int[] numbers){
    int curr = numbers[0];
    for(int i = 0 ; i < numbers.length ; i++)
      if (numbers[i] > curr)
      curr = numbers[i];
    return curr;
  }
}


import java.util.Scanner;
import Stats.*;

public class GetStats{
  public static void main(String [] args){
    int[]num = Stats.integers();
    Stats.minMax(num);
    Stats.mean(num);
  }
}

Posting in code tags would help and posting what line the error is in will also be helpful to those answering.

The error is saying that you either haven't imported that package, or are trying to use one that doesn't exist.

Thats just my guess :) as I'm fairly 'new' to it as well

Remove this line

import Stats.*;

Stats is a class, not a package, and if you have these in the same directory there is no need to import.

ahhhh thank you!!! and i'll keep in mind how to post next time! :)

hi am from india. am create a one program in java my pgm name is truition.java.
am imported to all jar and package files but still i have an error in my file edeal.coreg package doesnot exists. if any one help me. ple

hi am from india. am create a one program in java my pgm name is truition.java.
am imported to all jar and package files but still i have an error in my file edeal.coreg package doesnot exists. if any one help me. ple

1. create a new thread instead of hijacking a thread that has been dormant (not to say dead) for years
2. don't expect us to find the errors in your code if you don't show any code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.