zoukankan      html  css  js  c++  java
  • java变量、数据类型

    public class Test {
        public static void main(String[] args) {
            //变量
            //数据类型 变量名;
            //基本数据类型:
            //一个字节8位
                //整型 byte(1)、short(2)、int(4)、long(8)
                //浮点 float、double
                //字符 char''
                //布尔boolean (true、false)
            //引用数据类型:
                //数组
                ////接口
            int i;//变量声明
            //变量的赋值
            //初始化指第一次赋值
            i = 1;
            i = 2;
            System.out.println(i);
            //+ - * / %
            // =
            // == >= <= !=
            //&& ||
            //& |
            System.out.println(1+2+"3");
            System.out.println(1+"2"+3);
            System.out.println("1"+2+3);
        }
        public void get(){
            int i;
            i = 3;
            System.out.println(i);
        }
        //变量的作用域,一个变量的作用域是包在其最近的大括号{}
    }

    运行结果:

    2
    33
    123
    123

  • 相关阅读:
    centos 7 和 centoa 8的区别
    centos7制作U盘启动盘
    juypyter notebook安装
    Centos6安装MariaDB
    提job
    report a bug and update
    runtest提交job
    bug
    ps常用选项
    每日一句
  • 原文地址:https://www.cnblogs.com/makangning/p/9379215.html
Copyright © 2011-2022 走看看