I understand that your creating a Apple class apple and passing variable applePrice to it but i want to know how the addprice works how does the operator work tried to exchange subtract but didnt work like Apple.subtractPrice(100);
package en.codegym.task.jdk13.task04.task0402;
/*
Price of apples
*/
public class Solution {
public static void main(String[] args) {
Apple apple = new Apple();
Apple.Price(50);
Apple apple2 = new Apple();
Apple.addPrice(100);
System.out.println("Apple price " + Apple.applePrice);
}
public static class Apple {
public static int applePrice = 0;
public static void addPrice(int applesPrice) {
Apple.applePrice = Apple.applePrice + applesPrice;
}
}
}