JAVA-day01(1-170)

  • 一、基本的语法结构
    • 0.编译方法
    • 1.基本程序框架(01)
    • 2.从用户界面接收输入信息的语法(03)
    • 3.向用户界面输出文字(03)
    • 4.if语句运行规则(03)
    • 5.for循环运行规则(04)
    • 6.while循环结构
    • 7.dowhile循环结构
  • 二、实例
    • 1.基本程序框架
    • 2.从用户界面接收输入信息的语法
    • 5.for循环运行规则
  • 总结

一、基本的语法结构

0.编译方法

#mermaid-svg-uqt6ii2wW1kXSZ6V .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .label text{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .node rect,#mermaid-svg-uqt6ii2wW1kXSZ6V .node circle,#mermaid-svg-uqt6ii2wW1kXSZ6V .node ellipse,#mermaid-svg-uqt6ii2wW1kXSZ6V .node polygon,#mermaid-svg-uqt6ii2wW1kXSZ6V .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-uqt6ii2wW1kXSZ6V .node .label{text-align:center;fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .node.clickable{cursor:pointer}#mermaid-svg-uqt6ii2wW1kXSZ6V .arrowheadPath{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-uqt6ii2wW1kXSZ6V .flowchart-link{stroke:#333;fill:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-uqt6ii2wW1kXSZ6V .edgeLabel rect{opacity:0.9}#mermaid-svg-uqt6ii2wW1kXSZ6V .edgeLabel span{color:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-uqt6ii2wW1kXSZ6V .cluster text{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-uqt6ii2wW1kXSZ6V .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-uqt6ii2wW1kXSZ6V text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .actor-line{stroke:grey}#mermaid-svg-uqt6ii2wW1kXSZ6V .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .sequenceNumber{fill:#fff}#mermaid-svg-uqt6ii2wW1kXSZ6V #sequencenumber{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V #crosshead path{fill:#333;stroke:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .messageText{fill:#333;stroke:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-uqt6ii2wW1kXSZ6V .labelText,#mermaid-svg-uqt6ii2wW1kXSZ6V .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .loopText,#mermaid-svg-uqt6ii2wW1kXSZ6V .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-uqt6ii2wW1kXSZ6V .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-uqt6ii2wW1kXSZ6V .noteText,#mermaid-svg-uqt6ii2wW1kXSZ6V .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-uqt6ii2wW1kXSZ6V .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-uqt6ii2wW1kXSZ6V .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-uqt6ii2wW1kXSZ6V .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .section{stroke:none;opacity:0.2}#mermaid-svg-uqt6ii2wW1kXSZ6V .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-uqt6ii2wW1kXSZ6V .section2{fill:#fff400}#mermaid-svg-uqt6ii2wW1kXSZ6V .section1,#mermaid-svg-uqt6ii2wW1kXSZ6V .section3{fill:#fff;opacity:0.2}#mermaid-svg-uqt6ii2wW1kXSZ6V .sectionTitle0{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .sectionTitle1{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .sectionTitle2{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .sectionTitle3{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-uqt6ii2wW1kXSZ6V .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .grid path{stroke-width:0}#mermaid-svg-uqt6ii2wW1kXSZ6V .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-uqt6ii2wW1kXSZ6V .task{stroke-width:2}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText:not([font-size]){font-size:11px}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-uqt6ii2wW1kXSZ6V .task.clickable{cursor:pointer}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText0,#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText1,#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText2,#mermaid-svg-uqt6ii2wW1kXSZ6V .taskText3{fill:#fff}#mermaid-svg-uqt6ii2wW1kXSZ6V .task0,#mermaid-svg-uqt6ii2wW1kXSZ6V .task1,#mermaid-svg-uqt6ii2wW1kXSZ6V .task2,#mermaid-svg-uqt6ii2wW1kXSZ6V .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutside0,#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutside2{fill:#000}#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutside1,#mermaid-svg-uqt6ii2wW1kXSZ6V .taskTextOutside3{fill:#000}#mermaid-svg-uqt6ii2wW1kXSZ6V .active0,#mermaid-svg-uqt6ii2wW1kXSZ6V .active1,#mermaid-svg-uqt6ii2wW1kXSZ6V .active2,#mermaid-svg-uqt6ii2wW1kXSZ6V .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-uqt6ii2wW1kXSZ6V .activeText0,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeText1,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeText2,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeText3{fill:#000 !important}#mermaid-svg-uqt6ii2wW1kXSZ6V .done0,#mermaid-svg-uqt6ii2wW1kXSZ6V .done1,#mermaid-svg-uqt6ii2wW1kXSZ6V .done2,#mermaid-svg-uqt6ii2wW1kXSZ6V .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-uqt6ii2wW1kXSZ6V .doneText0,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneText1,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneText2,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneText3{fill:#000 !important}#mermaid-svg-uqt6ii2wW1kXSZ6V .crit0,#mermaid-svg-uqt6ii2wW1kXSZ6V .crit1,#mermaid-svg-uqt6ii2wW1kXSZ6V .crit2,#mermaid-svg-uqt6ii2wW1kXSZ6V .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCrit0,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCrit1,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCrit2,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCrit0,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCrit1,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCrit2,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-uqt6ii2wW1kXSZ6V .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-uqt6ii2wW1kXSZ6V .milestoneText{font-style:italic}#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCritText0,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCritText1,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCritText2,#mermaid-svg-uqt6ii2wW1kXSZ6V .doneCritText3{fill:#000 !important}#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCritText0,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCritText1,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCritText2,#mermaid-svg-uqt6ii2wW1kXSZ6V .activeCritText3{fill:#000 !important}#mermaid-svg-uqt6ii2wW1kXSZ6V .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-uqt6ii2wW1kXSZ6V g.classGroup text .title{font-weight:bolder}#mermaid-svg-uqt6ii2wW1kXSZ6V g.clickable{cursor:pointer}#mermaid-svg-uqt6ii2wW1kXSZ6V g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-uqt6ii2wW1kXSZ6V g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-uqt6ii2wW1kXSZ6V .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-uqt6ii2wW1kXSZ6V .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .dashed-line{stroke-dasharray:3}#mermaid-svg-uqt6ii2wW1kXSZ6V #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V .commit-id,#mermaid-svg-uqt6ii2wW1kXSZ6V .commit-msg,#mermaid-svg-uqt6ii2wW1kXSZ6V .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-uqt6ii2wW1kXSZ6V g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-uqt6ii2wW1kXSZ6V g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-uqt6ii2wW1kXSZ6V g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-uqt6ii2wW1kXSZ6V .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-uqt6ii2wW1kXSZ6V .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-uqt6ii2wW1kXSZ6V .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-uqt6ii2wW1kXSZ6V .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-uqt6ii2wW1kXSZ6V .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-uqt6ii2wW1kXSZ6V .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-uqt6ii2wW1kXSZ6V .edgeLabel text{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-uqt6ii2wW1kXSZ6V .node circle.state-start{fill:black;stroke:black}#mermaid-svg-uqt6ii2wW1kXSZ6V .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-uqt6ii2wW1kXSZ6V #statediagram-barbEnd{fill:#9370db}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-state .divider{stroke:#9370db}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-uqt6ii2wW1kXSZ6V .note-edge{stroke-dasharray:5}#mermaid-svg-uqt6ii2wW1kXSZ6V .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-uqt6ii2wW1kXSZ6V .error-icon{fill:#522}#mermaid-svg-uqt6ii2wW1kXSZ6V .error-text{fill:#522;stroke:#522}#mermaid-svg-uqt6ii2wW1kXSZ6V .edge-thickness-normal{stroke-width:2px}#mermaid-svg-uqt6ii2wW1kXSZ6V .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-uqt6ii2wW1kXSZ6V .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-uqt6ii2wW1kXSZ6V .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-uqt6ii2wW1kXSZ6V .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-uqt6ii2wW1kXSZ6V .marker{fill:#333}#mermaid-svg-uqt6ii2wW1kXSZ6V .marker.cross{stroke:#333}:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-uqt6ii2wW1kXSZ6V {color: rgba(0, 0, 0, 0.75);font: ;}

Windows+R调用dos系统
输入cmd
输入要运行文件的地址
输入javac Helloworld.java
#mermaid-svg-4g5cofK5ok4QOEhC .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-4g5cofK5ok4QOEhC .label text{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .node rect,#mermaid-svg-4g5cofK5ok4QOEhC .node circle,#mermaid-svg-4g5cofK5ok4QOEhC .node ellipse,#mermaid-svg-4g5cofK5ok4QOEhC .node polygon,#mermaid-svg-4g5cofK5ok4QOEhC .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-4g5cofK5ok4QOEhC .node .label{text-align:center;fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .node.clickable{cursor:pointer}#mermaid-svg-4g5cofK5ok4QOEhC .arrowheadPath{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-4g5cofK5ok4QOEhC .flowchart-link{stroke:#333;fill:none}#mermaid-svg-4g5cofK5ok4QOEhC .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-4g5cofK5ok4QOEhC .edgeLabel rect{opacity:0.9}#mermaid-svg-4g5cofK5ok4QOEhC .edgeLabel span{color:#333}#mermaid-svg-4g5cofK5ok4QOEhC .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-4g5cofK5ok4QOEhC .cluster text{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-4g5cofK5ok4QOEhC .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-4g5cofK5ok4QOEhC text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-4g5cofK5ok4QOEhC .actor-line{stroke:grey}#mermaid-svg-4g5cofK5ok4QOEhC .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-4g5cofK5ok4QOEhC .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-4g5cofK5ok4QOEhC #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-4g5cofK5ok4QOEhC .sequenceNumber{fill:#fff}#mermaid-svg-4g5cofK5ok4QOEhC #sequencenumber{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC #crosshead path{fill:#333;stroke:#333}#mermaid-svg-4g5cofK5ok4QOEhC .messageText{fill:#333;stroke:#333}#mermaid-svg-4g5cofK5ok4QOEhC .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-4g5cofK5ok4QOEhC .labelText,#mermaid-svg-4g5cofK5ok4QOEhC .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-4g5cofK5ok4QOEhC .loopText,#mermaid-svg-4g5cofK5ok4QOEhC .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-4g5cofK5ok4QOEhC .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-4g5cofK5ok4QOEhC .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-4g5cofK5ok4QOEhC .noteText,#mermaid-svg-4g5cofK5ok4QOEhC .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-4g5cofK5ok4QOEhC .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-4g5cofK5ok4QOEhC .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-4g5cofK5ok4QOEhC .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-4g5cofK5ok4QOEhC .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .section{stroke:none;opacity:0.2}#mermaid-svg-4g5cofK5ok4QOEhC .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-4g5cofK5ok4QOEhC .section2{fill:#fff400}#mermaid-svg-4g5cofK5ok4QOEhC .section1,#mermaid-svg-4g5cofK5ok4QOEhC .section3{fill:#fff;opacity:0.2}#mermaid-svg-4g5cofK5ok4QOEhC .sectionTitle0{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .sectionTitle1{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .sectionTitle2{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .sectionTitle3{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-4g5cofK5ok4QOEhC .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .grid path{stroke-width:0}#mermaid-svg-4g5cofK5ok4QOEhC .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-4g5cofK5ok4QOEhC .task{stroke-width:2}#mermaid-svg-4g5cofK5ok4QOEhC .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .taskText:not([font-size]){font-size:11px}#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-4g5cofK5ok4QOEhC .task.clickable{cursor:pointer}#mermaid-svg-4g5cofK5ok4QOEhC .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-4g5cofK5ok4QOEhC .taskText0,#mermaid-svg-4g5cofK5ok4QOEhC .taskText1,#mermaid-svg-4g5cofK5ok4QOEhC .taskText2,#mermaid-svg-4g5cofK5ok4QOEhC .taskText3{fill:#fff}#mermaid-svg-4g5cofK5ok4QOEhC .task0,#mermaid-svg-4g5cofK5ok4QOEhC .task1,#mermaid-svg-4g5cofK5ok4QOEhC .task2,#mermaid-svg-4g5cofK5ok4QOEhC .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutside0,#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutside2{fill:#000}#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutside1,#mermaid-svg-4g5cofK5ok4QOEhC .taskTextOutside3{fill:#000}#mermaid-svg-4g5cofK5ok4QOEhC .active0,#mermaid-svg-4g5cofK5ok4QOEhC .active1,#mermaid-svg-4g5cofK5ok4QOEhC .active2,#mermaid-svg-4g5cofK5ok4QOEhC .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-4g5cofK5ok4QOEhC .activeText0,#mermaid-svg-4g5cofK5ok4QOEhC .activeText1,#mermaid-svg-4g5cofK5ok4QOEhC .activeText2,#mermaid-svg-4g5cofK5ok4QOEhC .activeText3{fill:#000 !important}#mermaid-svg-4g5cofK5ok4QOEhC .done0,#mermaid-svg-4g5cofK5ok4QOEhC .done1,#mermaid-svg-4g5cofK5ok4QOEhC .done2,#mermaid-svg-4g5cofK5ok4QOEhC .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-4g5cofK5ok4QOEhC .doneText0,#mermaid-svg-4g5cofK5ok4QOEhC .doneText1,#mermaid-svg-4g5cofK5ok4QOEhC .doneText2,#mermaid-svg-4g5cofK5ok4QOEhC .doneText3{fill:#000 !important}#mermaid-svg-4g5cofK5ok4QOEhC .crit0,#mermaid-svg-4g5cofK5ok4QOEhC .crit1,#mermaid-svg-4g5cofK5ok4QOEhC .crit2,#mermaid-svg-4g5cofK5ok4QOEhC .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-4g5cofK5ok4QOEhC .activeCrit0,#mermaid-svg-4g5cofK5ok4QOEhC .activeCrit1,#mermaid-svg-4g5cofK5ok4QOEhC .activeCrit2,#mermaid-svg-4g5cofK5ok4QOEhC .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-4g5cofK5ok4QOEhC .doneCrit0,#mermaid-svg-4g5cofK5ok4QOEhC .doneCrit1,#mermaid-svg-4g5cofK5ok4QOEhC .doneCrit2,#mermaid-svg-4g5cofK5ok4QOEhC .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-4g5cofK5ok4QOEhC .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-4g5cofK5ok4QOEhC .milestoneText{font-style:italic}#mermaid-svg-4g5cofK5ok4QOEhC .doneCritText0,#mermaid-svg-4g5cofK5ok4QOEhC .doneCritText1,#mermaid-svg-4g5cofK5ok4QOEhC .doneCritText2,#mermaid-svg-4g5cofK5ok4QOEhC .doneCritText3{fill:#000 !important}#mermaid-svg-4g5cofK5ok4QOEhC .activeCritText0,#mermaid-svg-4g5cofK5ok4QOEhC .activeCritText1,#mermaid-svg-4g5cofK5ok4QOEhC .activeCritText2,#mermaid-svg-4g5cofK5ok4QOEhC .activeCritText3{fill:#000 !important}#mermaid-svg-4g5cofK5ok4QOEhC .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-4g5cofK5ok4QOEhC g.classGroup text .title{font-weight:bolder}#mermaid-svg-4g5cofK5ok4QOEhC g.clickable{cursor:pointer}#mermaid-svg-4g5cofK5ok4QOEhC g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-4g5cofK5ok4QOEhC g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-4g5cofK5ok4QOEhC .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-4g5cofK5ok4QOEhC .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-4g5cofK5ok4QOEhC .dashed-line{stroke-dasharray:3}#mermaid-svg-4g5cofK5ok4QOEhC #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC .commit-id,#mermaid-svg-4g5cofK5ok4QOEhC .commit-msg,#mermaid-svg-4g5cofK5ok4QOEhC .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-4g5cofK5ok4QOEhC g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-4g5cofK5ok4QOEhC g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-4g5cofK5ok4QOEhC g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-4g5cofK5ok4QOEhC .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-4g5cofK5ok4QOEhC .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-4g5cofK5ok4QOEhC .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-4g5cofK5ok4QOEhC .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-4g5cofK5ok4QOEhC .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-4g5cofK5ok4QOEhC .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-4g5cofK5ok4QOEhC .edgeLabel text{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-4g5cofK5ok4QOEhC .node circle.state-start{fill:black;stroke:black}#mermaid-svg-4g5cofK5ok4QOEhC .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-4g5cofK5ok4QOEhC #statediagram-barbEnd{fill:#9370db}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-state .divider{stroke:#9370db}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-4g5cofK5ok4QOEhC .note-edge{stroke-dasharray:5}#mermaid-svg-4g5cofK5ok4QOEhC .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-4g5cofK5ok4QOEhC .error-icon{fill:#522}#mermaid-svg-4g5cofK5ok4QOEhC .error-text{fill:#522;stroke:#522}#mermaid-svg-4g5cofK5ok4QOEhC .edge-thickness-normal{stroke-width:2px}#mermaid-svg-4g5cofK5ok4QOEhC .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-4g5cofK5ok4QOEhC .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-4g5cofK5ok4QOEhC .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-4g5cofK5ok4QOEhC .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-4g5cofK5ok4QOEhC .marker{fill:#333}#mermaid-svg-4g5cofK5ok4QOEhC .marker.cross{stroke:#333}:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}#mermaid-svg-4g5cofK5ok4QOEhC {color: rgba(0, 0, 0, 0.75);font: ;}

最后运行
输入java Helloworld

1.基本程序框架(01)

public class HelloWorld{public static void main(String[] args){System.out.println("Hello World!");}
}

2.从用户界面接收输入信息的语法(03)

java.util.Scanner s=new java.util.Scanner(System.in);
int a=s.nextInt();

3.向用户界面输出文字(03)

System.out.println("欢迎使用本系统!")
System.out.println("请输入指令:")

注释:实例与上题同。

4.if语句运行规则(03)

if(weather==1){//下雨天System.out.println("下雨天");}else if(weather==0){//晴天System.out.println("晴天");}

注释:实例与上题同。

5.for循环运行规则(04)

for(int i=1;i<=10;i+=1){System.out.println(i);
}for(int i=1;i<=10;i++){System.out.println(i);
}for(int i=1;i<=10;i=i+1){System.out.println(i);
}

6.while循环结构

while(布尔表达式){循环体;
}

7.dowhile循环结构

do{循环体;
}while(布尔表达式);

二、实例

1.基本程序框架

public class HelloWorld{public static void main(String[] args){System.out.println("Hello World!");}
}

2.从用户界面接收输入信息的语法

public class IfTest
{public static void main(String[] args){java.util.Scanner s=new java.util.Scanner(System.in);System.out.println("欢迎使用本系统,您通过本系统可以完成一些简单的判断");System.out.println("说明1:1表示下雨,0表示晴天");System.out.println("说明2:1表示男,0表示女");System.out.println("说明3:温度为数字");//接收性别System.out.print("请输入性别:");int sex=s.nextInt();//接收天气的状况System.out.print("请输入当前天气状况:");int weather=s.nextInt();if(weather==1){//下雨天//System.out.println("下雨天");if(sex==1){System.out.println("带一把大黑伞");}else if(sex==0){System.out.println("带一把小花伞");}else{System.out.println("对不起,您的性别是怎么回事?");}}else if(weather==0){//晴天//System.out.println("晴天");int tem=s.nextInt();if(tem>30){if(sex==1){System.out.println("戴墨镜");}else if(sex==0){System.out.println("擦防晒霜");}else{System.out.println("对不起,您的性别是怎么回事?");}}else{System.out.println("对不起,您输入的天气状况不存在!");}}}
}

注解:其中,s为输入信息的句段名称,a为输入信息在程序中的名称。两次输入都可以用s作为名称。

5.for循环运行规则

public class ForTest
{public static void main(String[] args){for(int i=0;i<10;i++){System.out.println("i--->"+i);}System.out.println(i);}
}

或者写为如下形式:

public class ForTest
{public static void main(String[] args){int i;for(i=0;i<10;i++){System.out.println("i--->"+i);}System.out.println(i);}
}

总结

提示:这里对文章进行总结:
这是第一次对java学习所做的笔记。希望学习不辍,进步不止。

JAVA-day01相关推荐

  1. java day01第一课java简介

    java简介 个人简介 陈杜杰 联系方式:18227288633 从事java后台开发三年多,在创业公司和国企做过开发 熟悉JAVA.HTML.JS.CSS等语言 教学方式: 1.尊重学生,希望学生是 ...

  2. JAVA day01 变量和数据类型、运算符

    变量 变量:是指在内存中开辟的存储空间,用于存放运算过程中需要用到的数据. 比如:int a = 12 这里的 a 就是变量 数据类型 java的数据类型分为两大类: 基本数据类型:整数.浮点数.字符 ...

  3. 重新学习Java Day01

    Markdown学习 二级标题 ##+空格 三级标题 ###+空格 四级标题 ####+空格 字体 Hello,World! 两边加两个*号变粗体 Hello,World! 一边一个*号 变斜体 He ...

  4. Java day01

    Java简介 Java,是由Sun Microsystems公司于1995年5月推出的Java程序设计语言和Java平台的总称. 作者是詹姆斯·高斯林, 被称为java之父. 1996年发布了JDK1 ...

  5. cmd中加载java源文件_如何在cmd中编译和运行java源文件

    如何在cmd中编译和运行java源文件 首先写一个名为HelloWorld.java的java源文件,存储在如C:/java/src的地址,我们再假设待会要存储的位置是C:/java/bin,则我们做 ...

  6. 黑马程序员---java基础------------------基础中的基础学习

    1:最常用的dos操作: 进入指定磁盘:盘符: 比如>>>>d:加回车键. 创建文件夹:md空格文件名    比如md kkk回车键 进入指定文件:先转到指定的磁盘下,然后执行 ...

  7. Java相关课程系列笔记之一Java学习笔记

    目 录 一. Java技术基础 1 1.1编程语言 1 1.2 Java的特点 1 1.3 Java开发环境 1 1.4 Java开发环境配置 2 1.5 Linux命令与相关知识 2 1.6 Ecl ...

  8. java中把路径定义到src下的_设置java路径路径

    JDK环境变量配置 java设置classpath,path,java_home环境变量 Windows7安装JDK的环境变量设置Windows7 X64安装"jdk-6u26-window ...

  9. java基础篇_java基础篇1

    JAVA基础篇1 注释 单行注释 //这是一个单行注释,由两个斜杠组成,不能嵌套多行注释 多行注释 /*这是一个 多行注释 ,//里面不能嵌套多行注释, 但是可以嵌套单行注释*/ 文档注释 /**ja ...

  10. Lunix基础终端控制器操作

    Linux基础(Commands) 认识Linux 操作系统的三大组成及作用 内核: 管理硬件设备.内存.进程等: Shell: 介于用户与内核之间,用于将用户指令传递给内核,起到中间桥梁的作用(相当 ...

最新文章

  1. 在这个什么都看脸的时代,如何用 GUI 提高 python 程序的颜值?
  2. bat 域 本机管理员密码_域渗透——Local Administrator Password Solution
  3. ansible(5)——使用通配符操作ansible命令
  4. js map对象遍历_何时使用 Map 来代替变通的 JS 对象
  5. Dynamics 365执行操作报SQL Server已超时,更改这个超时设置的方法
  6. Python文件读取(1.1)
  7. 最全攻略:利用LightSeq加速你的深度学习模型
  8. 相机标定+极线矫正+elas生成视差图
  9. 下列选项中 采用边界值平滑_2014年10月湖南自考:软件工程全真模拟试题二
  10. python分析《水浒传》小说,对文本数据内容清洗、分词、统计、词云可视化展示
  11. 【日记本砸】21.02.01-12 过程只是过程,目的才是目的。
  12. oracle 18c 新特性,Oracle 18c新特性测试
  13. Krpano全景图制作教程
  14. 优秀的海外住宅代理该从哪几个角度判断?
  15. 直播继续搅局双11?
  16. AStar 拐点 算法实现AI寻路
  17. 布袋除尘器过滤风速多少_布袋除尘器过滤风速的确定标准是什么?
  18. 电脑经常自动关机的系统解决方案
  19. java返回 0 到 50 随机整数
  20. 使用bartender打印RFID标签如何正确写入EPCID(intermec的RFID条码打印机)

热门文章

  1. 什么是网络爬虫?它是如何工作的以及如何自动抓取
  2. VINS-Mono中的边缘化与滑窗 (2)—— 边缘化最老帧
  3. 2022~2023计算机毕业设计之题目选题
  4. java 双击触发事件_java鼠标双击事件怎么实现
  5. python之冒泡排序
  6. ubuntu更改环境变量的方法
  7. 安卓转战React-Native之windows下android环境搭建爬坑血泪史
  8. 程序员考证,这十大证书含金量最高
  9. 制动器作用停止 发那科机器人_FANUC机器人:奇异点回避功能介绍与使用方法
  10. 【你也能看得懂得电磁场与电磁波系列连载 3】