0


【JAVA】通过JAVA实现用户界面的登录

](https://img-blog.csdnimg.cn/21dd41dce63a4f2da07b9d879ad0120b.png#pic_center)

🌈个人主页: Aileen_0v0
🔥热门专栏: 华为鸿蒙系统学习|计算机网络|数据结构与算法|MySQL|
💫个人格言:“没有罗马,那就自己创造罗马~”

#mermaid-svg-wyCvaz0EBNwHcwsi {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi .error-icon{fill:#552222;}#mermaid-svg-wyCvaz0EBNwHcwsi .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-wyCvaz0EBNwHcwsi .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-wyCvaz0EBNwHcwsi .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-wyCvaz0EBNwHcwsi .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-wyCvaz0EBNwHcwsi .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-wyCvaz0EBNwHcwsi .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-wyCvaz0EBNwHcwsi .marker{fill:#333333;stroke:#333333;}#mermaid-svg-wyCvaz0EBNwHcwsi .marker.cross{stroke:#333333;}#mermaid-svg-wyCvaz0EBNwHcwsi svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-wyCvaz0EBNwHcwsi .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi .cluster-label text{fill:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi .cluster-label span{color:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi .label text,#mermaid-svg-wyCvaz0EBNwHcwsi span{fill:#333;color:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi .node rect,#mermaid-svg-wyCvaz0EBNwHcwsi .node circle,#mermaid-svg-wyCvaz0EBNwHcwsi .node ellipse,#mermaid-svg-wyCvaz0EBNwHcwsi .node polygon,#mermaid-svg-wyCvaz0EBNwHcwsi .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-wyCvaz0EBNwHcwsi .node .label{text-align:center;}#mermaid-svg-wyCvaz0EBNwHcwsi .node.clickable{cursor:pointer;}#mermaid-svg-wyCvaz0EBNwHcwsi .arrowheadPath{fill:#333333;}#mermaid-svg-wyCvaz0EBNwHcwsi .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-wyCvaz0EBNwHcwsi .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-wyCvaz0EBNwHcwsi .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-wyCvaz0EBNwHcwsi .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-wyCvaz0EBNwHcwsi .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-wyCvaz0EBNwHcwsi .cluster text{fill:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi .cluster span{color:#333;}#mermaid-svg-wyCvaz0EBNwHcwsi div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-wyCvaz0EBNwHcwsi :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}
consequent on随之而来

文章目录

实参和形参的关系
publicclassTest{publicstaticvoidswap(int a ,int b){int tmp = a;
        a = b;
        b = tmp;}publicstaticvoidmain(String[] args){int x =10;int y =20;swap(x,y);System.out.println(x);System.out.println(y);}}

+++9

在这里插入图片描述
JAVA 当中无法获取到 局部变量的地址. 实参和形参的关系就像榨汁机一样,丢进去的是橙子,出来的是橙汁.

publicclassTest{publicstaticvoidmain(String[] args){int[] arr ={10,20};swap(arr);System.out.println("arr[0] = "+ arr[0]+"arr[1] = "+ arr[1]);}publicstaticvoidswap(int[] arr){int tmp = arr[0];
        arr[0]= arr[1];
        arr[1]= tmp;}}

在这里插入图片描述
虽然数组通过下标可以交换它的位置,但它的内存地址并未发生改变.
所以说,数组不能传某一块的内存地址.

  • return 代表法方的结束.
  • return后的代码不会被执行.

方法重载
publicclassTest{publicstaticdoubleadd(double d ,double c){return  d + c;}//     Overload 重载publicstaticintadd(int d ,int c){return  d + c;}publicstaticlongadd(long d ,int c){return  d + c;}publicstaticlongadd(long d ,int c ,int b){return  d + c;}publicstaticvoidmain(String[] args){int x =10;int y =20;int ret =add(x, y);System.out.println(ret);double d1 =10.5;double d2 =12.5;double dd =add(d1, d2);System.out.println(dd);}}

在这里插入图片描述
根据上面的代码我们可以知道,方法的重载遵循以下原则:
(1)方法名一样.
(2)方法的参数列表不一样[个数,数据类型,顺序]
(3)返回值是否一样,不影响方法重载. ___

EXERCISES1-模拟登录

在这里插入图片描述

publicclassX{publicstaticvoidmain(String[] args){int count =3;Scanner scanner =newScanner(System.in);while(count !=0){System.out.println("请输入您的密码");String password = scanner.nextLine();if(password.equals("123456")){System.out.println("登陆成功");return;// 通过 return退出程序}else{System.out.println("输入错误,请重新登录");
                count--;}}System.out.println("程序已退出");}}

在这里插入图片描述


](https://img-blog.csdnimg.cn/0ee6c4ec414740b0a0404c5161cdadc7.gif#pic_center)

](https://img-blog.csdnimg.cn/cc002cbd5c414c5393e19c5e0a0dbf20.gif#pic_center#pic_center)

标签: java ui 开发语言

本文转载自: https://blog.csdn.net/Aileenvov/article/details/136925088
版权归原作者 Aileen_0v0 所有, 如有侵权,请联系我们删除。

“【JAVA】通过JAVA实现用户界面的登录”的评论:

还没有评论