java - Is there any way to override methods in NetBeans automatically? -


i have overriding on several java classes 1 super class. used suggestions , shortcuts so. netbeans automatically override methods.

but when need change method in super class, have 1 one. there method override them automatically?

thanks netbeans, can done easily.

imagine project structure:

refactordemo |-- parent.java |-- child.java 

and sample code:

parent.java

package refactordemo; public class parent {     public static void main(string[] args) {      }     public string method1() {         return null;     } } 

child.java

package refactordemo; public class child extends parent {     public static void main(string[] args) {      }     @override     public string method1() {         return super.method1();     } } 

notice method1() of class child overrides method1() of class parent.

now, if want change signature (return type, method name, parameters) of method1() in class parent , want changes in child classes, netbeans need.

  1. go parent.java (parent class)
  2. find method signature want change (method1() in case)
  3. right click on method name
  4. go refactor > change method parameters... enter image description here

there... have all.

what stuff can here:

enter image description here

  1. add / remove parameters.
  2. change data type of existing parameters.
  3. change access modifier of method.
  4. change return type of method.
  5. change name of method.

the changes did

after making required changes, click 'refactor' @ bottom of window.

anytime better ctrl-c , ctrl-v

please note using netbeans 8.0.1 per knowledge feature present since netbeans 7.3


Comments

Popular posts from this blog

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -