Shared using Java Programs With Output(Android app) https://play.google.com/store/apps/details?id=com.freeit.java
public class BicycleDemo { public static void main(String[] args)
{ // Create two different // Bicycle objects Bicycle bike1 = new Bicycle(); Bicycle bike2 = new Bicycle(); //Invoke methods on // those objects bike1.changeCadence(50); bike1.speedUp(10); bike1.changeGear(2); bike1.printStates(); bike2.changeCadence(50); bike2.speedUp(10); bike2.changeGear(2); bike2.changeCadence(40); bike2.speedUp(10); bike2.changeGear(3); bike2.printStates(); } } class Bicycle { int cadence = 0; int speed = 0; int gear = 1; void changeCadence(int newValue) { cadence = newValue; } void changeGear(int newValue) { gear = newValue; } void speedUp(int increment) { speed = speed + increment; } void applyBrakes(int decrement) { speed = speed - decrement; } void printStates() { System.out.println("cadence:" + cadence + " speed:" + speed + " gear:" + gear); } }
Hey guys above is a code for a java application please leave your comments.
This is the application that is mos
tly used to create most of this mobile app.
Popular Posts
-
Computing takes place mainly in offices, factories, and homes. Local Area Networks (LANs) connect workstations in a building or campus or fa...
-
W e all have connection to the internet and we create our user profiles in the many websites some are even social networks.But a number of...
-
For a list of confirmed transfers, check out the transfers page. Visit our manager ins and outs page for a list of ...
-
Here are some of the ways one can earn online include. This ways include selling stuff online one can sell his or her stuffs online you can...
bidadve
Total Pageviews
Monday, 10 February 2014
Example of a program in java application (program)
Labels:
courses,
data,
game development.,
student
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment