- 浏览: 125868 次
- 性别:
- 来自: 河北
文章分类
- 全部博客 (93)
- 生活感悟 (1)
- 面试 (3)
- struts2 (1)
- java 综合 (25)
- 杂 (4)
- 数据库综合 (3)
- 数据库-Mysql (2)
- 数据库-SQLServer (0)
- 数据库-Oracle (0)
- 数据库-PostgreSQL (0)
- 数据库-SQLite (0)
- 数据库-MongoDB (0)
- 数据库-Redis (0)
- 操作系统-Windows (4)
- 操作系统-Linux (0)
- 操作系统-Mac (0)
- 操作系统-Unix (0)
- 移动端-Android (0)
- 移动端-IOS (0)
- 开发环境-Eclipse (1)
- 开发环境-IntelliJ IDEA (0)
- JEE-Spring (1)
- JEE-Hibernate (0)
- JEE-Struts2 (1)
- JEE-Struts (0)
- JEE-Spring Cloud (0)
- JEE-Spring Boot (0)
- JEE-接口调试 (0)
- 云计算-Zookeeper (0)
- 云计算-Hadoop (0)
- 云计算-HBase (0)
- 测试-JUnit (0)
- 测试-JMeter (0)
- 项目管理 (0)
- 版本控制 (0)
- 消息中间件 (0)
- 应用服务器-Tomcat (2)
- 应用服务器-Jetty (0)
- 框架-Antlr (0)
- 编程语言-Java (1)
- 编程语言-C# (0)
- 编程语言-C (0)
- 编程语言-Python (0)
- 编程语言-Lua (0)
- 编程语言-Javascript (0)
最新评论
-
java苏打粉:
...
java servlet doPost与doGet方法的理解 -
真狼王:
将禁用脚本测试(Internet Exploer)和禁用脚本调 ...
ie下调试javascript -
javaservers:
说了个大概原理,没做任何实现那。
JDBC连接池 -
yangzhihuan:
都是些实用的技巧.整理是很辛苦了,多谢分享.
jquery 常用技巧
Java代码
public class StringTest2
{
String s1 = "H";
String s2 = "ello";
String s3 = s1 + s2;
String s4 = "H" + "ello";
static String ss1 = "H";
static String ss2 = "ello";
static String ss3 = ss1 + ss2;
static String ss4 = "H" + "ello";
final String fs1 = "H";
final String fs2 = "ello";
final String fs3 = fs1 + fs2;
final String fs4 = "H" + "ello";
static final String sfs1 = "H";
static final String sfs2 = "ello";
static final String sfs3 = sfs1 + sfs2;
static final String sfs4 = "H" + "ello";
public static void main(String[] args)
{
StringTest2 st = new StringTest2();
st.test1();
}
public void test1()
{
String str1 = "H";
String str2 = "ello";
String str3 = "Hello";
String str4 = str1 + str2;
String str5 = "H" + "ello";
//1
System.out.println(str3 == str4);
System.out.println(str3 == str5);
//2
System.out.println();
System.out.println(str3 == s3);
System.out.println(str3 == s4);
//3
System.out.println();
System.out.println(str3 == ss3);
System.out.println(str3 == ss4);
//4
System.out.println();
System.out.println(str3 == fs3);
System.out.println(str3 == fs4);
//5
System.out.println();
System.out.println(str3 == sfs3);
System.out.println(str3 == sfs4);
}
}
public class StringTest2
{
String s1 = "H";
String s2 = "ello";
String s3 = s1 + s2;
String s4 = "H" + "ello";
static String ss1 = "H";
static String ss2 = "ello";
static String ss3 = ss1 + ss2;
static String ss4 = "H" + "ello";
final String fs1 = "H";
final String fs2 = "ello";
final String fs3 = fs1 + fs2;
final String fs4 = "H" + "ello";
static final String sfs1 = "H";
static final String sfs2 = "ello";
static final String sfs3 = sfs1 + sfs2;
static final String sfs4 = "H" + "ello";
public static void main(String[] args)
{
StringTest2 st = new StringTest2();
st.test1();
}
public void test1()
{
String str1 = "H";
String str2 = "ello";
String str3 = "Hello";
String str4 = str1 + str2;
String str5 = "H" + "ello";
//1
System.out.println(str3 == str4);
System.out.println(str3 == str5);
//2
System.out.println();
System.out.println(str3 == s3);
System.out.println(str3 == s4);
//3
System.out.println();
System.out.println(str3 == ss3);
System.out.println(str3 == ss4);
//4
System.out.println();
System.out.println(str3 == fs3);
System.out.println(str3 == fs4);
//5
System.out.println();
System.out.println(str3 == sfs3);
System.out.println(str3 == sfs4);
}
}
输出如下:
Java代码
false
true
false
true
false
true
true
true
true
true
public class StringTest2
{
String s1 = "H";
String s2 = "ello";
String s3 = s1 + s2;
String s4 = "H" + "ello";
static String ss1 = "H";
static String ss2 = "ello";
static String ss3 = ss1 + ss2;
static String ss4 = "H" + "ello";
final String fs1 = "H";
final String fs2 = "ello";
final String fs3 = fs1 + fs2;
final String fs4 = "H" + "ello";
static final String sfs1 = "H";
static final String sfs2 = "ello";
static final String sfs3 = sfs1 + sfs2;
static final String sfs4 = "H" + "ello";
public static void main(String[] args)
{
StringTest2 st = new StringTest2();
st.test1();
}
public void test1()
{
String str1 = "H";
String str2 = "ello";
String str3 = "Hello";
String str4 = str1 + str2;
String str5 = "H" + "ello";
//1
System.out.println(str3 == str4);
System.out.println(str3 == str5);
//2
System.out.println();
System.out.println(str3 == s3);
System.out.println(str3 == s4);
//3
System.out.println();
System.out.println(str3 == ss3);
System.out.println(str3 == ss4);
//4
System.out.println();
System.out.println(str3 == fs3);
System.out.println(str3 == fs4);
//5
System.out.println();
System.out.println(str3 == sfs3);
System.out.println(str3 == sfs4);
}
}
public class StringTest2
{
String s1 = "H";
String s2 = "ello";
String s3 = s1 + s2;
String s4 = "H" + "ello";
static String ss1 = "H";
static String ss2 = "ello";
static String ss3 = ss1 + ss2;
static String ss4 = "H" + "ello";
final String fs1 = "H";
final String fs2 = "ello";
final String fs3 = fs1 + fs2;
final String fs4 = "H" + "ello";
static final String sfs1 = "H";
static final String sfs2 = "ello";
static final String sfs3 = sfs1 + sfs2;
static final String sfs4 = "H" + "ello";
public static void main(String[] args)
{
StringTest2 st = new StringTest2();
st.test1();
}
public void test1()
{
String str1 = "H";
String str2 = "ello";
String str3 = "Hello";
String str4 = str1 + str2;
String str5 = "H" + "ello";
//1
System.out.println(str3 == str4);
System.out.println(str3 == str5);
//2
System.out.println();
System.out.println(str3 == s3);
System.out.println(str3 == s4);
//3
System.out.println();
System.out.println(str3 == ss3);
System.out.println(str3 == ss4);
//4
System.out.println();
System.out.println(str3 == fs3);
System.out.println(str3 == fs4);
//5
System.out.println();
System.out.println(str3 == sfs3);
System.out.println(str3 == sfs4);
}
}
输出如下:
Java代码
false
true
false
true
false
true
true
true
true
true
发表评论
-
Webservice 报错 Have you run APT to generate them
2013-08-27 10:23 871原因是找不到类 ,生成webservice 后自运生成包装类, ... -
你的java单例安全吗
2010-12-05 20:51 739今天在写一个东西需要用的单例模式,一般的单列模式可分为以下两种 ... -
java 命名规则
2010-11-27 11:43 938变量 第一位为英文小写字母,该英文小写字母代表变数类型。然后 ... -
HashSet和TreeSet的区别
2010-11-27 11:32 958今天学到的,备注一下: 1、Treeset中的数据是自 ... -
java的静态方法和非静态方法
2010-11-27 00:02 808public class Test { p ... -
java之try与finally语句(2)
2010-11-26 23:55 901接上一篇,跟上一篇代码差不多,就是修改了a的值为double类 ... -
java try finally
2010-11-26 23:50 942如下面的代码,结果就不解释了。 Java代码 pub ... -
抽象类和接口区别
2010-11-26 23:47 818如下代码,是使用接口时需要注意的问题。 Java代码 pu ... -
java之final, finally, finalize的区别
2010-11-26 23:44 9221. final 用于声明属性,方法和类,分别表示属性不可变, ... -
求最小公倍数和最大公约数
2010-11-26 23:42 697下面的方法是用递归解决的。如求几个整数的最小公倍数的 ... -
java汉字截取问题
2010-11-26 23:40 732public class Test { p ... -
java之String变量和“==”操作符(1)
2010-11-26 23:26 874先看下面的代码,有助于后面的理解。 Java代码 p ... -
java 之动态绑定和静态绑定
2010-11-26 22:59 812package cn.lifx.test; pub ... -
java基础之"=="操作符
2010-11-26 21:16 586Java代码 public class Test { ... -
java 内部类测试
2010-11-26 20:53 923Java代码 public class OuterInner ... -
java 之继承
2010-11-26 20:48 722public class Test { p ... -
java catch 语句
2010-11-26 20:44 974public class Test { p ... -
java try catch exception
2010-11-26 20:40 1111public class InputTest { ... -
java类的初始化
2010-11-26 20:35 739Java代码 public class Test1 ... -
无法进入构造方法
2010-11-26 20:32 766刚刚搞定了一个大bug 搞了好几个小时了 问题很简单 ...
相关推荐
表达式中有一个操作元是long型,则结果是long型的问题总结; 应该调用String的equals()方法,而不用“==”操作符的注意; java虚拟机对变量初始化为默认值。
== 操作符专门用来比较两个变量的值是否相等,也就是用于比较变量所对应的内存中所存储的数值是否相同,要比较两个基本类型的数据或两个引用变量是否相等,只能用==操作符。 如果一个变量指向的数据是对象类型的...
a和b都使用了new操作符,意味着将在内存中产生两个内容为"foo"的字符串,既然是“两个”,它们自然位于不同的内存地址。a和b的值其实是两个不同的内存地址的值,所以使用"=="操作符,结果会是false。诚然,a和b所指...
今天小编就为大家分享一篇关于java字符串中${}或者{}等的占位符替换工具类,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编来看看吧
showOrder_2.java 演示操作数求值顺序示例2 sign.java 用条件运算实现符号函数示例 signByIF.java 用if语句实现符号函数示例 triangleStar.java 输出一个由*组成的直角三角形 upperToLowCase.java 大写转换成...
a和b都使用了new操作符,意味着将在内存中产生两个内容为"foo"的字符串,既然是“两个”,它们自然位于不同的内存地址。a和b的值其实是两个不同的内存地址的值,所以使用"=="操作符,结果会是false。诚然,a和b所指...
观事务的软件化模拟,是变量(数据和数据结构)和相关方法(对数据操作和对象管理的程 序)的软件组合。 在面向对象的程序设计中,你可以用软件对象表示现实世界的对象,而这些软件对象和 现实世界对象是相对应的。...
问题一:我声明了什么! String s = "Hello world!"; 许多人都做过这样的事情,但是,我们到底声明了什么?回答通常是:一个String,内容是... ==操作符专门用来比较变量的值是否相等。比较好理解的一点是:
instanceof是Java的一个二元操作符,和==,>,<是同一类东东。由于它是由字母组成的,所以也是Java的保留关键字。它的作用是测试它左边的对象是否是它右边的类的实例,返回boolean类型的数据。然而,这种做法通常被...
53 为可配置的解析器加入和操作操作符 531 修改已存在的操作符 532 优先级和绑定 533 将操作符加入操作符表 534 标准操作符的绑定和优先级 54 使用标准解析器添加操作符 541 编辑标准的解析器语法 55 其他操作符集 ...
本书将向读者展示用Java语言和它的类库创建2D游戏,所涉及的主题包括高速性能、双缓冲图像、动画、声音、媒体控制、I/O和网络支持等。将带领大家一步一步学习编写Java游戏,最终打造属于自己的Java游戏。 目录...
robotframework——变量... 不过需要注意, 在UNIX-like操作系统中, 要使⽤双引号 将整个选项值括起来: 这些变量⽂件中的变量在所有测试⽂件中全局可见, 这点和通过选项 --variable 来设置 单个变量 类似. 如果同时使⽤
2 软 件 的 开 发 方 法 :由 于 Java 语 言 的 面 向 目 标 的 特 性 , 所以完 全 可 以 用 O-O的技 术 与 方 法 来 开 发 ,这 是 符 合 最 新 的 软件 开 发 规 范 要 求 的 。 3 Java 语 言 的 动 画 效 果 远 ...
6.2.3 使用点操作符的技巧 148 6.2.4 类的数组 149 6.3 小结:Java其实是个类和对象的世界 152 6.4 习题 153 第7章 Java中的方法——给汽车丰富多彩的功能 154 教学视频:2小时55分钟 7.1 方法:让汽车动开动 ...
6.2.3 使用点操作符的技巧 148 6.2.4 类的数组 149 6.3 小结:Java其实是个类和对象的世界 152 6.4 习题 153 第7章 Java中的方法——给汽车丰富多彩的功能 154 教学视频:2小时55分钟 7.1 方法:让汽车动开动 ...
"=="和equals方法究竟有... ==操作符专门用来比较变量的值是否相等。 int a=10; int b=10; 则a==b将是true。 但: String a=new String("foo"); String b=new String("foo"); 则a==b将返回false。
Java编译语言将Java代码编译成.class文件(只有一种形式),而C/C++语言将代码编译成01码,不同的操作系统的01码指令不同,这造成了不能跨平台,而Java将这个任务交给JVM,不同操作系统上的JVM将.class文件编译成不同...
private是一个修饰符,可以用来修饰成员(成员变量,成员方法) 被private修饰的成员,只能在本类进行访问,针对private修饰的成员变量,如果需要被其他类使 用,提供相应的操作 提供“get变量名()”方法,用于...
1.1 Java语言发展简史2 1.2 认识Java语言3 1.2.1 Java语言特性3 1.2.2 JavaApplet4 1.2.3 丰富的类库4 1.2.4 Java的竞争对手5 1.2.5 Java在应用领域的优势7 1.3 Java平台的体系结构7 1.3.1 JavaSE标准版8 1.3.2 ...