摘要: 一、逻辑运算的相关符号 二、相关知识点 1、逻辑运算符用于连接布尔型表达式,在Java中不可以写成3<x<6,应该写成x>3 & x<6 。2、“&”和“&&”的区别: 单&时,左边无论真假,右边都进行运算;双&时,如果左边为真,右边参与运算,如果左边为假,那么右边不参与运算(可以理解为从左往右计算 阅读全文
posted @ 2020-03-10 15:20 wzwzzzzz 阅读(110) 评论(0) 推荐(0)
摘要: 一、比较运算 1、比较运算符的结果都是boolean型,也就是要么是true,要么是false。2、比较运算符“==”不能误写成“=” 。 示例: public class Test { public static void main(String[] args) { System.out.prin 阅读全文
posted @ 2020-03-09 16:43 wzwzzzzz 阅读(156) 评论(0) 推荐(0)
摘要: 一、可以连续赋值 public class datatype { public static void main(String[] args) { int m = 1; int n = 1; int l = 1; m = n =l=8; System.out.println(m+n+l); } } 阅读全文
posted @ 2020-03-09 16:21 wzwzzzzz 阅读(302) 评论(0) 推荐(0)
摘要: 一、java 2个整数相除后会舍弃小数位,如下: public class datatype { public static void main(String[] args) { String c = 3l + ""; //3后面待l,表示long System.out.println(c); in 阅读全文
posted @ 2020-03-08 23:01 wzwzzzzz 阅读(168) 评论(0) 推荐(0)
摘要: 一、初始变量 初始变量就是对变量进行第一次赋值,运行代码以最终的赋值结果进行输出。 public class datatype { public static void main(String[] args) { int a =1; // 声明初始变量 a =2; System.out.printl 阅读全文
posted @ 2020-03-08 19:22 wzwzzzzz 阅读(277) 评论(0) 推荐(0)
摘要: 以下是java源码: public class test{ public static void main(String[] args){ System.out.println("test"); byte a=1; //这里结束需要分号; 以下类推 System.out.println(a); sh 阅读全文
posted @ 2020-03-07 16:59 wzwzzzzz 阅读(1047) 评论(0) 推荐(0)
摘要: public class iloveyouright{ public static void main(String[] args){ System.out.println("\t*\t\t\t*"); System.out.println("*\t\ti love you\t\t*"); Syst 阅读全文
posted @ 2020-03-06 14:40 wzwzzzzz 阅读(223) 评论(0) 推荐(0)
摘要: public class hello_world{ public static void main(String[] args){ System.out.println("Hello world!"); } } class hello_world1{ public static void main( 阅读全文
posted @ 2020-03-06 14:34 wzwzzzzz 阅读(165) 评论(0) 推荐(0)