So im working on a public and private case and i posted ealier with issues, but i thought i had most of them fixed and turns out fixing those just opened up more problems... any help is appreciated thank you! ( I am very new to using java...)

/**
 * @(#)Pet.java
 *
 * Pet application
 *
 * @author 
 * @version 1.00 2013/2/13
 */


 public static void main(String[] args)
public class Pet 
{

        // This gives the user a field to store the name in
        private String name;
        private String type;
        private double age;

      public Pet(String n, String t, double a)
      {
         name = n;
         type = t;
         age = a;
      }
    public void setName(String n)
    {
        name = n;
    }
    public void setType(String t)
    {
        type = t;
    }
    public void setType(double a)
    {
        age = a;
    }
    public String getName()
    {
        return name;
    }
    public String getType()
    {
        return type;
    }
    public double getAge()
    {
        return age;
    }

}

Then my second code is :


import java.util.Scanner;

public class PetTest
 {
    public static void main(String[] args)
    {
        String testName; // test name
        String testType; //test type
        double testAge; // test age


        Scanner keyboard = new Scanner(System.in);

        // get pets name
        System.out.print("Enter your pets name: ");
        testN= keyboard.nextLine();

        // get pets age
        System.out.print("Enter your pets age: ");
        testA= keyboard.nextDouble();

        // get type of pet
        System.out.print("Enter the type of pet you have: ");
        testT= keyboard.nextLine();

        //pass information received to the original pet class
        Pet p= new Pet(testN, testT, testA);

        //display the output
        System.out.println();
        System.out.println("Here is the information your have provided: ");
        System.out.println("Name:  " + pet.getName());
        System.out.println("Type:  " + pet.getType());
        System.out.println("Age:  " + pet.getAge());

 }
}

this is the issue... sorry : Error: Main method not found in class Pet, please define the main method as:
public static void main(String[] args)

You should run PetTest [1] instead of Pet.
If you're on the command line this means that you have to invoke as: java PetTest (after compiling).

Also you have to remove what's on line 11, its syntax is invalid.

[1] Because this class contains the main method.

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.