How to Override A Method in Java -


i play robocode (it java programming game). want change method

public void onscannedrobot (scannedrobotevent e) {  } 

to

public int onscannedrobot(scannedrobotevent e){ } 

so can adapt robot more if scanned true or false.

i heard possible overriding method. tryed it:

i wrote:

public void onscannedrobot(scannedrobotevent e) {      public int onscannedrobot(scannedrobotevent e) {         return 1;     } } 

but won't work

this won't work because return type of overriden method should same or subtype of return type declared in original method. @ link overriding , overloading


Comments

  1. Hello Admin,

    A significant qualification in classes of help purchase does among deeded furthermore right-to-use understandings.

    Regards,
    Thanks

    RITU

    ReplyDelete
  2. In the dynamic world of digital marketing, where imagination meets analytics, businesses unlock limitless possibilities by crafting compelling stories, fostering brand resonance, and igniting a digital revolution that propels them towards unrivaled triumph.
    Digital marketing institute in Delhi

    ReplyDelete
  3. Why just use social media when you can build a career shaping it?

    At the Nora Solomon Skill Development Centre, Vasant Kunj, our Digital Marketing Skill Development Program teaches you how brands grow online. From SEO to Google Ads to content strategy—you’ll gain hands-on training and real project experience.

    With guidance from NIIT Foundation and National YMCA, you’ll not only learn the tools but also the confidence to thrive in the digital world.

    ReplyDelete

Post a Comment

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

c++ - Serialize a class with a Qlist of custom classes as member (using QDataStream) -

Read video using VideoReader function in Matlab? -