大纲:一.分支结构 if switch二.循环 for while do while break continue三.格式化输出 [printf] int score = 100; String name = "张三": int number = 19; System.out.println(name + "的分数是" + score + "分,排名为第" + number + "名.");换用格式化输出:System.out…
Concurrency However, becoming adept at concurrent programming theory and techniques is a step up from everything you've learned so far in this book, and is an intermediate to advanced topic. In practice, however, it's much easier to write concurrent…
在一次做题中遇到了switch的问题,由于对switch执行顺序的不了解,在这里简单的通过字节码的方式理解一下switch执行顺序(题目如下): public class Ag{ static public int i=10; public static void main(String []args){ switch(i){ default: System.out.println("this is default"); case 1: System.out.println("…
一.switch练习 public class d21_{ public static void main(String[] args) { java.util.Scanner s = new java.util.Scanner(System.in); System.out.print("请输入今天星期几:"); String dayOfWeek = s.next(); switch(dayOfWeek) { case "星期一" : System.out.prin…
基础 我们现在使用的Java的版本,基本上是都支持String类型的.当然除了String类型,还有int.char.byte.short.enum等等也都是支持的.然而在其底部实现中,还是基于 整型的,也就是int.byte.short这些类型. 我们先来看一下int的一个简单例子,主要部分源代码 public static void main(String [] args){ int n = 2; switch (n){ case 1: break; case 2: break; case…
一.Collections的常用方法介绍 1.承接上次连载,先介绍几个简单的常用方法 package com.bjpowernode.java_learning; import java.util.*; public class D84_1_CommonMethodOfCollection { public static void main(String[] args) { //1.创建集合 Collection c = new ArrayList();//多态 //2.添加元素 c.add(1…