Eclipse4.7 using the base accelerator to override the ToString method in a subclass

Source: Internet
Author: User




Os:windows7 x64
Jdk:jdk-8u131-windows-x64
Ide:eclipse Oxygen Release (4.7.0)

The original code

Package Jizuiku.eleven302;public class Javaer {private int age;private String name;public int getnum () {return age;} public void Setnum (int.) {this.age = age;} Public String GetName () {return name;} public void SetName (String name) {this.name = name;} Press ALT + SHIFT + S to press S to appear}

Press the shortcut key ALT + SHIFT + S to appear


Press the S key again to appear


Effect Show

Package Jizuiku.eleven302;public class Javaer {private int age;private String name;public int getnum () {return age;} public void Setnum (int.) {this.age = age;} Public String GetName () {return name;} public void SetName (String name) {this.name = name;} @Overridepublic String toString () {return "Javaer [age=" + Age + ", name=" + name + "]";} Press ALT + SHIFT + S to press S to appear}

Test the ToString method of this class

Package Jizuiku.eleven302;public class Demo {public static void main (string[] args) {System.out.println (New Javaer (). ToString ());}}

Effect Show

Java is good, worth learning.
Eclipse is a free, powerful IDE that you should learn to use.

Eclipse4.7 to override the ToString method in a subclass by using the underlying shortcut key

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.