Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34903
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2016-07-15 11:54 -0700 |
| Message-ID | <746d328e-d360-4268-ace5-07a9931955ae@googlegroups.com> (permalink) |
| Subject | Error in build |
| From | Steve Graham <solitary.wanderer52@gmail.com> |
While trying to build, I got the following error. I have tried changing a few things. The classes are adapted from Oracle's Java tutorial. I would think that the Bicycle class would be "pulled in" via the common package statement.
Any help would be appreciated.
Steve
---
Error while trying to build Bicycle Demo:
C:\Users\TheUser \Documents\NetBeansProjects\Bicycle Demo\src\bicycle\demo\BicycleDemo.java:19: error: cannot find symbol
Bicycle bike1 = new Bicycle();
symbol: class Bicycle
location: class BicycleDemo
---
Bicycle:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Bicycle;
/**
*
* @author User-LibertyITS
*/
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);
}
}
Bicycle Demo:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Bicycle;
/**
*
* @author User-LibertyITS
*/
class BicycleDemo {
/**
* @param args the command line arguments
*/
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();
}
}
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Error in build Steve Graham <solitary.wanderer52@gmail.com> - 2016-07-15 11:54 -0700 Re: Error in build Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-07-15 15:15 -0400
csiph-web