2017/05/07 java 基础 随笔
生活随笔
收集整理的這篇文章主要介紹了
2017/05/07 java 基础 随笔
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1.^異或? 邏輯運(yùn)算符? 兩邊相同為false? 不同為ture
2.鍵盤錄入
package com.huawei; /*** 鍵盤錄入* @author Eric**/ import java.util.Scanner; public class Demo1 {public static void main(String[] args) {System.out.println("請(qǐng)輸入一個(gè)整數(shù)");Scanner sc=new Scanner(System.in);int x=sc.nextInt();System.out.println(x);}}3.switch 語句可以接受的表達(dá)式
?1)byte short? char int
?2)枚舉、字符串
?
4.switch語句,case可以省略嗎?
?不可以,case穿透(皇上翻牌子,執(zhí)行兩個(gè)^_^)
?5.switch結(jié)束兩種情況? break,}
package com.huawei; /*** switch結(jié)束break,或者}* @author Eric**/ public class Demo3 {public static void main(String[] args) {int a=2,y=3;switch (a) {default:y++;case 2:y++;case 4:y++;break;}System.out.println("y="+y);}}?6.while 和for的區(qū)別
for語句執(zhí)行完,變量會(huì)被釋放,while執(zhí)行后,初始化變量還可以使用
7.轉(zhuǎn)義字符
\ " ——— "
\'? ——— '
\t? ———tab鍵
\r? ———回車
\n? ———換行
8.break只能使用在switch和循環(huán)中
9.continue只能使用在循環(huán)中
10.標(biāo)號(hào)
下面的代碼沒有問題
?
?
11.重載
方法名相同,參數(shù)列表不同,與返回值類型無關(guān);
轉(zhuǎn)載于:https://www.cnblogs.com/jycjy/p/6821105.html
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的2017/05/07 java 基础 随笔的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ubuntu设置root用户密码
- 下一篇: 109. Convert Sorted