zoukankan      html  css  js  c++  java
  • NIIT2--JAVA活动(一)制作内部类 正则内部类

     1 package details;
     2 
     3 import java.util.Scanner;
     4 
     5 public class Candidtates {
     6     private String name,qualification ,status;
     7     private int age;
     8     
     9     public void getCandiatesDetails() {
    10         Scanner sc=new Scanner(System.in);
    11         System.out.println("Enter your name:");
    12         name=sc.next();
    13         System.out.println("Enter your qualification:");
    14         qualification =sc.next();
    15         System.out.println("Enter your age");
    16         age=sc.nextInt();
    17         
    18          AgeValidation obj=new  AgeValidation();
    19          obj.validateAge();
    20         
    21     }
    22     //正则内部类
    23     private class  AgeValidation {
    24         public void validateAge() {
    25             if(age>=21 && age<=25) {
    26                 status="selected";
    27             }
    28             else {
    29                 status="rejected";
    30                 
    31             }
    32         }
    33     }
    34     public void printCandiatesDetails() {
    35         System.out.println("Name:"+name);
    36         System.out.println("qualification"+qualification);
    37         System.out.println("age"+age);
    38         System.out.println("Selection status"+status);
    39     }
    40 
    41 
    42 public static void main(String[] args) {
    43     Candidtates candidate =new Candidtates();
    44     candidate.getCandiatesDetails();
    45     candidate.printCandiatesDetails();
    46     
    47     
    48 }
    49 }
  • 相关阅读:
    unity panel删除drawcall失败导致的残留影像
    c# List的排序
    动画播放一段就禁用
    delegate用法
    ctrl+alt+end 修改桌面密码
    Windows 下curl htpps
    Linux下端口映射工具rinetd
    Linux系统下强制踢掉登录用户
    linux ls 按文件大小排序
    chrome的功能Copy as cURL
  • 原文地址:https://www.cnblogs.com/Catherinezhilin/p/8534086.html
Copyright © 2011-2022 走看看