- 博客(94)
- 收藏
- 关注
原创 字符串
比较字符串相等可以使用equals方法检测两个字符串是否相等。对于表达式:s.equals(t),如果字符串 s 与字符串 t 相等, 则返回 true ; 否则, 返回 false。 一定不要使用= 运算符检测两个字符串是否相等! 这个运算符只能够确定两个字串是否放置在同一个位置上。当然, 如果字符串放置在同一个位置上, 它们必然相等。但是,完全有可能将内容相同的多个字符串的拷贝放置在不同...
2018-08-17 17:53:54
204
原创 数值类型转换
上图给出了数值类型之间的合法转换。实心箭头表示无信息丢失的转换;虚线箭头表示可能有精度损失。 当有2个数值进行二元操作时(如a+b),先要将2个操作数转换为同一种类型,然后进行计算:如果其中有一个double,另一个也转换为double;否则,如果其中有一个是float,另一个也转换为float;否则,如果其中有一个是long,另一个也转换为long;否则,都转换为int。...
2018-08-17 16:39:34
279
原创 javascript学习笔记-作用域
javascript没有块作用域for(var i = 0;i < 10; i++){ }alert(i); //结果会输出10ES6引入了关键字let.for(let i = 0;i < 10; i++){ }alert(i); //报错 Uncaught ReferenceError: i is not defined
2018-03-19 22:01:33
216
原创 javasript学习笔记-函数
函数定义1.直接声明function abs(x) { if (x >= 0) { return x; } else { return -x; }}2.函数表达式var abs = function (x) { if (x >= 0) { return x; } else {
2018-03-19 18:08:54
200
原创 js学习笔记-map 和 set
javascript也有map和set数据类型。map初始化map并通过key来取valuevar m = new Map([['Michael', 95], ['Bob', 75], ['Tracy', 85]]);m.get('Michael'); // 95var m = new Map(); // 空Mapm.set('Adam', 67); // 添加新的key-
2018-03-19 17:30:39
1114
原创 js学习笔记-对象
var xiaoming = { name: '小明', birth: 1990, school: 'No.1 Middle School', height: 1.70, weight: 65, score: null};in: 检测对象是否拥有某一属性。继承得到的属性也可以检测到。'name' in xiaoming //true'
2018-03-19 17:00:25
168
原创 js学习笔记-字符串
多行字符串:用反引号表示;反引号在键盘上的位置:ESC的下方`multiplestringhaha`模板字符串: 注意也是用反引号var name='Tom';var age=18; var message=`${name} is ${age} years old.`;console.log(message);//output:Tom is 18 years old....
2018-03-19 16:44:48
157
原创 第一次学习spring boot的吐血问题
spring boot的hello world demo,步骤见如下网址: http://how2j.cn/k/springboot/springboot-eclipse/1640.html http://how2j.cn/k/springboot/springboot-idea/1641.html但是到了我的机器上,两个IDE都显示如下问题: 2016-09-06 18:02:35.152
2018-03-13 10:00:06
645
2
原创 安装scoop
首先确认Windows Powershell已经安装,然后在powershell下执行如下命令:iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
2018-03-12 15:36:11
5905
原创 ssm java.lang.NullPointerException 在service.impl下面
java.lang.NullPointerException com.lightning.service.impl.CategoryServiceImpl.listCategories(CategoryServiceImpl.java:18) com.lightning.controller.CategoryController.listCategories(CategoryControlle...
2018-03-08 17:01:46
1801
3
原创 spring mvc 执行的流程
客户端请求提交到DispatcherServlet由DispatcherServlet控制器查询一个或多个HandlerMapping,找到处理请求的ControllerDispatcherServlet将请求提交到ControllerController调用业务逻辑处理后,返回ModelAndViewDispatcherServlet查询一个或多个ViewResoler视图解析器,找到Model...
2018-03-08 15:08:34
205
原创 java注解
什么是注解?Java中提供了Annotation功能,可用于类、构造方法、成员变量、方法、参数等的声明中,该功能并不影响程序的运行。为什么要学习注解?最近在学习spring、mybatis等框架,里面频繁使用注解。学习注解可以看懂框架相关的代码。JDK自带注解@Deprecated@Override@SuppressWarnings元注解用来注解注解的注解。@Target:设置annotat
2018-01-01 16:38:19
173
原创 Eclipse Maven "Create a simple project" 没有web.xml文件
创建完成后,pom.xml报错:web.xml is missing 解决办法: 右击项目名称 –> “Java EE Tools” –> “Generate Deployment Descriptor Stub”
2017-12-10 16:09:32
704
原创 访问控制修饰符
类的成员变量或方法需要通过访问控制修饰符来指定访问权限。public所在类所在类的子类同一个包中的类不同包中的类private只能在自己的类中被访问protected所在类所在类的子类同一个包中的类default (无修饰符)所在类同一个包中的类 Modifier Class Pacakge Subclas...
2017-08-26 10:49:23
281
原创 c#发邮件
try { string _sender = "your_email_address"; string _password = "your_email_password"; SmtpClient client = new SmtpClient("smtp-mail.outlook.c
2017-08-05 09:57:06
956
原创 第一次用Apache Commons CSV
在Eclipse新建java项目CSVExample。添加csv文件: 在”\CSVexample\src”目录下新建一个csv文件,或者将别处的csv文件复制到这个目录下。 内容如下: 下载Apache Commons CSV的源码并解压: https://commons.apache.org/proper/commons-csv/download_csv.cgi Binaries
2017-07-23 16:26:29
5042
原创 方法的重载
方法重载: 在一个类中有多个方法的名字相同,但参数类型或参数个数不同的函数。构成重载的条件: 1. 参数类型不同,构成重载; 2. 参数个数不同,构成重载; 3. 参数顺序不同,构成重载。 可以简单理解为,方法的名字一样,但是参数表不一样。 如果2个方法的名字一样,参数表也一样,即参数类型和个数均相同,只有返回值类型不同,则不构成重载,编译时会有错误提示(Duplicate method
2017-07-22 13:11:10
675
原创 Eclipse导出jar文件以及JAR File和Runnable JAR File的区别
现在我写好了一个java项目,想要导出可执行的jar文件。有两种方法,具体如下。I. Runnable JAR File点击Eclipse左上角的“File”按钮,选择“Export”。选择Java下的“Runnable JAR File”,点击“Next”。 直接”Finish”。 II. JAR FileFile>Import。选择Java下的“JAR File”,点击“Next”。 点
2017-07-19 21:24:06
4399
原创 向Eclipse导入项目以及问题解决
打开eclipse后,点击左上角的“File”按钮,选择“Import”。选择“Existing Project into Workspace”,点击“Next”。 点击“Browse”选择要导入的文件夹。在“Projects:”下勾选要导入的项目。点击“Finish”。问题解决 选择想要导入的文件夹后,发现“No projects are found to import”, 即eclip
2017-07-19 20:31:27
1345
原创 才知道java竟然没有运算符重载
写复数类的乘法和除法真的是要写死人了。。。public class Complex { private Fraction realPart; private Fraction imagePart; public Complex(Fraction real,Fraction image){ realPart=new Fraction(real); i
2017-07-11 22:16:02
7223
原创 PAT甲级1074. Reversing Linked List (25)
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you must output 3→2→1→6→5→4; if K =
2017-03-01 22:13:26
401
原创 PAT甲级1073. Scientific Notation (20)
Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9]”.”[0-9]+E[+-][0-9]+ which means that the int
2017-03-01 22:00:45
298
原创 PAT甲级1072. Gas Station (30)
A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the hous
2017-03-01 21:29:48
278
原创 PAT甲级1070. Mooncake (25)
Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region’s culture. Now g
2017-03-01 20:43:43
404
原创 1069. The Black Hole of Numbers (20)
For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by taking
2017-03-01 20:38:19
298
原创 PAT甲级1068. Find More Coins (30)
Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However,
2017-03-01 20:01:34
296
原创 PAT甲级1067. Sort with Swap(0,*) (25)
Given any permutation of the numbers {0, 1, 2,…, N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2, 1
2017-03-01 19:39:13
237
原创 PAT甲级1066. Root of AVL Tree (25)
An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is
2017-03-01 19:12:17
330
原创 PAT甲级1065. A+B and C (64bit) (20)
Given three integers A, B and C in [-2632^{63}, 2632^{63}], you are supposed to tell whether A+B > C. Input Specification: The first line of the input gives the positive number of test cases, T (<=1
2017-03-01 18:14:31
346
原创 PAT甲级1064. Complete Binary Search Tree (30)
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right subtr
2017-03-01 18:11:27
290
原创 PAT甲级1063. Set Similarity (25)
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of distinct numb
2017-03-01 18:07:58
244
原创 PAT甲级1062. Talent and Virtue (25)
About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and virtu
2017-03-01 18:02:47
321
原创 PAT甲级1061. Dating (20)
Sherlock Holmes received a note with some strange strings: “Let’s date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm”. It took him only a minute to figure out that those strange strings are ac
2017-03-01 18:00:08
342
原创 PAT甲级1060. Are They Equal (25)
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*105 with simple chopping. Now given the number of significan
2017-03-01 17:58:14
213
原创 PAT甲级1059. Prime Factors (25)
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1p_1^k1k_1 * p2 p_2^k2k_2 * …* pmp_m^kmk_m. Input Specification: Each input file co
2017-02-28 23:43:16
234
原创 PAT甲级1058. A+B in Hogwarts (20)
If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sick
2017-02-28 23:23:19
240
原创 PAT甲级1057. Stack (30)
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Pop
2017-02-28 23:18:20
365
原创 PAT甲级1056. Mice and Rice (25)
Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice
2017-02-28 23:04:17
421
原创 PAT甲级1055. The World's Richest (25)
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the people
2017-02-28 22:49:33
297
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人