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

How long does an spring initialized bean live?
How many times a specific character is in a String
Same TCP Socket (client-side) with two different scanners and two different BufferedReader
Java Thread wait and notify methods
Efficient way to store user records in a file in java [closed]
How to check if an Application was launched for the very first time [duplicate]
Construct org.w3c.dom.Document from marshalled object
Is it possible to test default / private class? [duplicate]
How to fetch many-to-many relationship entity
Win check not working in TicTacToe game?
Why is it recommended to call MultiDex.install() in attachBaseContext(Context)?
connecting two mobile phones over different network and then real time video streaming
Improving speed and memory consumption when handling ArrayList with 100 million elements
How to directly use a function as a Functional Type in Java 8
mvn -v show java information
java.lang.NoClassDefFoundError: IllegalName

Categories

HOME
wso2
netbeans
mockito
include
cvs
at-command
react-redux
gps
qore
gitpitch
google-apps-marketplace
ibm-odm
jsdoc
nhibernate-envers
django-cms
jprofiler
emulator
jtextfield
riot.js
jquery-ajaxq
facebook-instant-articles
tibco-mdm
captiveportal
php-openssl
blazemeter
tdd
bootstrap-duallistbox
wtx
windowbuilder
primitive
skia
socialengine
karaf
avcapturesession
serve
swift3.0.2
occlusion
g-code
botbuilder
keydown
outlook-api
http-redirect
modelmapper
slick-3.0
appcompat
multipeer-connectivity
clean-architecture
fancybox-2
aurelia-validation
forever
knockout-components
pg-dump
nxt
fputcsv
pickadate
bluegiga
energy
unity-networking
ios8-today-widget
execute
thredds
wyam
tableau-online
ideamart
facebook-graph-api-v2.4
block-device
system.net.webexception
cloud-connect
dataservice
easy-install
mylyn
http-unit
specification-pattern
runas
dsn
tridion-worldserver
chrono
spring-portlet-mvc
hgsubversion
fireworks
tomcat-valve
xtype
disclosure
datareader
dmx512
firefox-5
eqatec
zend-decorators
genealogy
w3wp

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App