java - why do I get "Error:(57, 21) error: reached end of file while parsing" -


this error get

error:(57, 21) error: reached end of file while parsing

while using code

package com.bilalbenzine.hotel;  import android.content.contentvalues; import android.content.intent; import android.net.uri; import android.os.bundle; import android.os.persistablebundle; import android.support.annotation.nullable; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.toast;  import com.google.android.gms.appindexing.action; import com.google.android.gms.appindexing.appindex; import com.google.android.gms.appindexing.thing; import com.google.android.gms.common.api.googleapiclient;  import io.realm.realm;  /**  * created hmito on 04/04/2017.  */  public class add_hotel extends appcompatactivity {      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.add_hotel);          final edittext name=(edittext)findviewbyid(r.id.name_hotel);         final edittext place=(edittext)findviewbyid(r.id.place_hotel);         final edittext stars=(edittext)findviewbyid(r.id.stars);         final edittext description=(edittext)findviewbyid(r.id.description);          final button addhotel=(button)findviewbyid(r.id.btn_add_hotel);         addhotel.hasonclicklisteners(new view.onclicklistener(){         @override             public void onclick(view view) {            hotel hotel = new hotel();            hotel.setname_hotel(name.gettext().tostring());            hotel.setname_hotel(place.gettext().tostring());            hotel.setname_hotel(stars.gettext().tostring());            hotel.setname_hotel(description.gettext().tostring());             realm realm = realm.getinstance(getapplicationcontext());            realm.begintransaction();            realm.copytorealmorupdate(hotel);            realm.committransaction();              toast.maketext(add_hotel.this, "the hotel has been added", toast.length_short).show();        }             );         }     } 

you miss pair {}. please use following code.

package com.bilalbenzine.hotel;  import android.content.contentvalues; import android.content.intent; import android.net.uri; import android.os.bundle; import android.os.persistablebundle; import android.support.annotation.nullable; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.edittext; import android.widget.toast;  import com.google.android.gms.appindexing.action; import com.google.android.gms.appindexing.appindex; import com.google.android.gms.appindexing.thing; import com.google.android.gms.common.api.googleapiclient;  import io.realm.realm;  /**  * created hmito on 04/04/2017.  */  public class add_hotel extends appcompatactivity  {      @override     public void oncreate(bundle savedinstancestate)      {         super.oncreate(savedinstancestate);         setcontentview(r.layout.add_hotel);          final edittext name=(edittext)findviewbyid(r.id.name_hotel);         final edittext place=(edittext)findviewbyid(r.id.place_hotel);         final edittext stars=(edittext)findviewbyid(r.id.stars);         final edittext description=(edittext)findviewbyid(r.id.description);          final button addhotel=(button)findviewbyid(r.id.btn_add_hotel);         addhotel.setonclicklistener(new view.onclicklistener(){              @override             public void onclick(view view) {                 hotel hotel = new hotel();                 hotel.setname_hotel(name.gettext().tostring());                 hotel.setname_hotel(place.gettext().tostring());                 hotel.setname_hotel(stars.gettext().tostring());                 hotel.setname_hotel(description.gettext().tostring());                  realm realm = realm.getinstance(getapplicationcontext());                 realm.begintransaction();                 realm.copytorealmorupdate(hotel);                 realm.committransaction();                   toast.maketext(add_hotel.this, "the hotel has been added", toast.length_short).show();             }             }             );         }     } 

Comments