共50道题 | 难度分布:★★★★☆平均 | 20K+ Java+AI岗位AI编程能力考察
★★★★★
★★★★
★★★★
★★★★★
★★★★
★★★★★
★★★★★
★★★★
★★★★★
★★★★★
# Claude Code基本使用
claude "refactor this class to use the Builder pattern"
claude "find all places where we catch generic Exception"
★★★★
★★★
★★★
★★★★
★★★★★
★★★★
★★★★
# .cursorrules示例
- 使用Java 21语法
- 遵循Spring Boot 3.2最佳实践
- 所有public方法必须写Javadoc
- 优先使用Optional而非null检查
★★★
★★★★★
★★★★★
String dbUrl = "${DB_URL}"而非实际URL。★★★★
★★★★
★★★★
★★★★
★★★
★★★★
★★★★★
Prompt示例:"使用Spring Boot 3.2实现一个RESTful API,
实体是Order(id, userId, amount, status),
需要CRUD + 按用户查询 + 按状态查询,
使用JPA + H2数据库,
包含全局异常处理和参数校验"
★★★★
★★★★
★★★★
// AI生成的测试示例
@Test
void shouldReturnOrderWhenValidId() {
Order order = new Order(1L, "user1", BigDecimal.TEN, Status.CREATED);
when(orderRepository.findById(1L)).thenReturn(Optional.of(order));
OrderResponse response = orderService.getOrder(1L);
assertThat(response.userId()).isEqualTo("user1");
}
★★★★
★★★★
★★★★
★★★★
★★★★
★★★★
★★★★
★★★★
# AI生成的Spring Boot Dockerfile
FROM eclipse-temurin:21-jre-alpine AS runtime
WORKDIR /app
COPY target/*.jar app.jar
USER nonroot
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
★★★
★★★
★★★★
★★★
★★★★★
★★★★
★★★★
★★★★
★★★★
★★★★
★★★
★★★★★