Q:

method to increment value of double variable and print in java

I am creating a method that should increase the weight variable value and print  The elephant has eaten 7.5 kilograms of food and now weighs (new weight). 
I am fairly new to java and would be grateful for any help. thank.
public class Elephant {

public static void main(String[] args) {
}// end of main
// instance variables

private String name ;
private double weight ;

// constructor
public Elephant(String name, double weight) {
    this.name = "elly";
    this.weight = 100;
}// end constructor
    // getter method

public String getName() {
    return name;
}

public double getWeight() {
    return weight;
}

// setter method
public void setName(String name) {
    this.name = name;
}

public void setWeight(double weight) {
    this.weight = weight;
}

public void Eatting(double kilosOfFood) {
    double consumed = weight + 7.5;
    System.out.println("The eleaphan has eating" +weight +" kilograms of 
    food and now weighs " + consumed + "Kg");
}
}// end of class

A:

What I do not understand is what you intend to do with the double kilosOfFood parameter in the Eatting method.
It should have been 

public void Eatting(double kilosOfFood) {
            double consumed = weight + kilosOfFood;
            System.out.println("The eleaphan has eating " + this.weight + "kilograms of food and now weighs " + consumed + "Kg");
        }

but below will compile correctly
public class Elephant {
        private String name ;
    private double weight ;

    // constructor
    public Elephant(String name, double weight) {
        this.name = name;
        this.weight = weight;
    }// end constructor
        // getter method

    public String getName() {
        return name;
    }

    public double getWeight() {
        return weight;
    }

    // setter method
    public void setName(String name) {
        this.name = name;
    }

    public void setWeight(double weight) {
        this.weight = weight;
    }

    public void Eatting(double kilosOfFood) {
        double consumed = weight + 7.5;
        System.out.println("The eleaphan has eating " + this.weight + "kilograms of food and now weighs " + consumed + "Kg");
    }

        public static void main(String args[]) {
           Elephant e = new Elephant("EE", 10.00);
           e.Eatting(2.5);
        }
    }

    The eleaphan has eating 10.0kilograms of food and now weighs 17.5Kg

You need to make changes to your main method, plus correct the grammar.

