Hi,
Help will be appreciated ALOT.
These are my codes:
redTeam.java
greenTeam.javaCode:package com.rs2hd.teams; import java.io.*; public class redTeam extends RandomAccessFile { // constructor Counter(String red) throws IOException { super(new File(red), "rw"); writeInt(0); } public void addToCounter() { addToCounter(1); } public void addToCounter(int delta) { try { int n = getValue() + delta; seek(0); writeInt(n); } catch(IOException e) {} } public int getValue() { try { seek(0); return readInt(); } catch (IOException e) {} return -1; } }
blueTeam.javaCode:package com.rs2hd.teams; import java.io.*; public class greenTeam extends RandomAccessFile { // constructor Counter(String green) throws IOException { super(new File(green), "rw"); writeInt(0); } public void addToCounter() { addToCounter(1); } public void addToCounter(int delta) { try { int n = getValue() + delta; seek(0); writeInt(n); } catch(IOException e) {} } public int getValue() { try { seek(0); return readInt(); } catch (IOException e) {} return -1; } }
These are the errors I get:Code:package com.rs2hd.teams; import java.io.*; public class blueTeam extends RandomAccessFile { // constructor Counter(String blue) throws IOException { super(new File(blue), "rw"); writeInt(0); } public void addToCounter() { addToCounter(1); } public void addToCounter(int delta) { try { int n = getValue() + delta; seek(0); writeInt(n); } catch(IOException e) {} } public int getValue() { try { seek(0); return readInt(); } catch (IOException e) {} return -1; } }
Compiling...
src\com\rs2hd\teams\redTeam.java:8: invalid method declaration; return type requ
ired
Counter(String red) throws IOException {
^
src\com\rs2hd\packethandler\CommandsPacketHandler.java:711: non-static method ad
dToCounter() cannot be referenced from a static context
redTeam.addToCounter();
^
src\com\rs2hd\teams\blueTeam.java:8: invalid method declaration; return type req
uired
Counter(String blue) throws IOException {
^
src\com\rs2hd\packethandler\CommandsPacketHandler.java:714: non-static method ad
dToCounter() cannot be referenced from a static context
blueTeam.addToCounter();
^
src\com\rs2hd\teams\greenTeam.java:8: invalid method declaration; return type re
quired
Counter(String green) throws IOException {
^
src\com\rs2hd\packethandler\CommandsPacketHandler.java:717: non-static method ad
dToCounter() cannot be referenced from a static context
greenTeam.addToCounter();
^
src\com\rs2hd\packethandler\CommandsPacketHandler.java:720: non-static method ge
tValue() cannot be referenced from a static context
int red = redTeam.getValue();
^
src\com\rs2hd\packethandler\CommandsPacketHandler.java:721: non-static method ge
tValue() cannot be referenced from a static context
int green = greenTeam.getValue();
^
src\com\rs2hd\packethandler\CommandsPacketHandler.java:722: non-static method ge
tValue() cannot be referenced from a static context
int blue = blueTeam.getValue();
^
9 errors
Druk op een toets om door te gaan. . .


Reply With Quote
Bookmarks