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.
- go parent.java (parent class)
- find method signature want change (
method1()in case) - right click on method name
- go refactor > change method parameters...

there... have all.
what stuff can here:

- add / remove parameters.
- change data type of existing parameters.
- change access modifier of method.
- change return type of method.
- change name of method.

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
Post a Comment