IDEA常用快捷键
package com.ydook.demo2.pojo;
import org.springframework.stereotype.Component;
// @Component:将 Car 类添加到 Spring 组件中
@Component
public class Car {
private String name;
private String price;
}
package com.ydook.demo2.pojo;
import org.springframework.stereotype.Component;
// @Component:将 Car 类添加到 Spring 组件中
@Component
public class Car {
private String name;
private String price;
public Car() {
}
}
package com.ydook.demo2.pojo;
import org.springframework.stereotype.Component;
// @Component:将 Car 类添加到 Spring 组件中
@Component
public class Car {
private String name;
private String price;
public Car() {
}
public Car(String name, String price) {
this.name = name;
this.price = price;
}
}
package com.ydook.demo2.pojo;
import org.springframework.stereotype.Component;
// @Component:将 Car 类添加到 Spring 组件中
@Component
public class Car {
private String name;
private String price;
public Car() {
}
public Car(String name, String price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public String getPrice() {
return price;
}
}
package com.ydook.demo2.pojo;
import org.springframework.stereotype.Component;
// @Component:将 Car 类添加到 Spring 组件中
@Component
public class Car {
private String name;
private String price;
public Car() {
}
public Car(String name, String price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public String getPrice() {
return price;
}
public void setName(String name) {
this.name = name;
}
public void setPrice(String price) {
this.price = price;
}
}
接口类
实现类
当我们实现了接口后,并没有像eclipse那样,鼠标放上去就会提示生成接口方法
鼠标定位到UserService类后面,快捷键:Alt+Enter;
选择Implement methods.
选中点OK就自动生成了.
还有一种方法,将鼠标放在接口的名称处按 Alt+Enter 键,就会出现下面页面:
鼠标左键单击:Implement interface ,进入创建实现类的名字以及指明其所在的包的界面
点击OK既可,生成的实现类会弹出实现接口方法框
参考: