Skip to content

Instantly share code, notes, and snippets.


codecademydev/ Secret

Created Oct 15, 2020
What would you like to do?
Codecademy export
public class Droid{
String name;
int batteryLevel;
public Droid (String droidName) {
name = droidName;
batteryLevel = 100;
public String toString(){
return ("Hello, I'm the droid:" + name);
public void performTask(String task){
System.out.println(name + " is performing task " + task);
batteryLevel -=10;
public void energyReport(){
System.out.println("The current battery level is: " + batteryLevel);
public static void main (String[]args){
Droid codey = new Droid("Codey");
codey.performTask ("Tickling.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment