java


compilation error: class, interface or enum expected


I get the error above during compilation.
The first place where it occurs is code:
public void clear(int i, int j) {
this.model[i][j]=0;
}
The code which it's inside is just a normal class with a constructor but without main(). This instance method is called from another .java file.
What am I doing wrong? Am I compiling something I shouldn't compile as a first file or something else?
My guess is you have a parantheses issue. You need the class/interface declaration. Make sure you start your class like:
public class Dog {
private int[][]model;
public Dog(){
//do nothing
}
public void clear(int i, int j) {
this.model[i][j]=0;
}
}

Related Links

possible values of port numbers of Tomcat and required changes in server.xml
Java 8 get field of contained Object
Sort XML alphabetically while mantaining XSD schema validity
use Java Monitor instead of Semaphore
How to work with regex to check a content of String
JSTL forEach doesn't loop [duplicate]
phonebook with arraylist in java
ArrayList<String> getIntent().getStringArrayListExtra
invoking an action of popup menu in Eclipse Plugin
Vbox Parent, Pane Child overlapping other components javafx
How to create a String array from an input.txt file
Java UI Manager look and feel (JTattoo) causes NULLpointer
Is there a way to make Mockito doNothing() when a method call actually returns something
POST request with HttpURLConnetion and read response from server - Android
can i compare using .equal() for two or more things in the same time
Disable clustering at max zoom level with Googles android-maps-utils

Categories

HOME
fluentd
kde
razor
installshield
alpha
ojdbc
podio
primary-key
numeral.js
resize
static-libraries
hapi
carthage
django-simple-history
worldwind
ghc
alpine
visual-composer
introduction
web-sql
css-animations
excel-2007
cultureinfo
facet
user-interaction
nhapi
entitlements
skia
microsoft-chart-controls
javascriptcore
.net-4.0
http-get
grails-3.1
framemaker
stringtemplate
geopositioning
ios5
scaffold
automake
twitch
impersonation
android-fingerprint-api
gzipstream
ruby-on-rails-3.1
reportingservices-2005
eigenvalue
isbn
import-from-excel
hibernate-tools
chain-builder
winscp-net
pebble-watch
lowpass-filter
mplayer
font-size
sybase-asa
memory-alignment
spring-cache
google-feed-api
elements
mikroc
ubuntu-10.04
pickadate
php-parse-error
javax.sound.midi
kendonumerictextbox
google-places
qdialog
simple-framework
feedback
varargs
php-ci
arcanist
sniffer
unity3d-gui
umbraco6
facebook-graph-api-v2.4
android-imagebutton
titanium-modules
google-reader
aapt
elliptic-curve
jquery-layout
didselectrowatindexpath
app42
gridfs
blending
quartz-graphics
cisco-jtapi
google-email-migration
ticoredatasync
bubble-chart
nsmanagedobject
assembly-loading
transactionscope
nsobject
xmemcached
inotifycollectionchanged
locate
fluent-interface
subviews
gamequery
castle-monorail

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App