Last active
January 31, 2020 05:41
-
-
Save damithc/c27161d3472ca2e2fe0fba923c81fc77 to your computer and use it in GitHub Desktop.
CS2113-M16: Tutorial 3, task 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Manage_Task { | |
private String description; | |
private boolean important; | |
private int i; // used to count tasks | |
String pastDescription[] = new String[10]; // a list of past descriptions | |
public Manage_Task(String d) { | |
this.description = d; | |
if (!d.isEmpty()) | |
// set as important | |
this.important = true; | |
} | |
public String getAsXML() { return "<task>"+description+"</task>"; } | |
public void printingDescription(){ System.out.println(this); } | |
public String toString() { return description; } | |
} |
Line 7: It should be String[] pastDescriptions instead of String pastDescription[]. Array specifiers must be attached to the type not the variable, and it should be plural form as stated by one of the comments above.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comments should be indented relative to their position in the code.
Method definitions should have the following form:
public void someMethod() throws SomeException {
...
}