Can someone help me with this? Im new to coding.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
10th Aug 2018, 3:20 PM
Jinyoongisaranghe
Jinyoongisaranghe - avatar
2 Answers
+ 11
import java.util.Scanner; public class Vehicle { int fuel; String colour; String brand; int getFuel() { return fuel; } void setFuel(int f) { fuel = f; } } public class tryhard { public static void main(String[] args) { Vehicle obj=new Vehicle(); Scanner wc = new Scanner(System.in); System.out.println("Enter price number of your fuel"); obj.setFuel(wc.nextInt()); System .out.println(obj.getFuel()); } }
10th Aug 2018, 3:55 PM
Hatsy Rei
Hatsy Rei - avatar
0
thanks a lot🤗
12th Aug 2018, 4:38 PM
Jinyoongisaranghe
Jinyoongisaranghe - avatar