JAVA期末考试整理
Technical problem:
0.read: Scanner input= new Scanner(System.in)
- random#: x=(int)(Math.random()*10) ,makes 0<=x<10.
Random class: Random ran=new Random(3);
Ran.nextInt();
- Switch(status){
Case 0: balabala;
Break;
Case 1:balabala;
Break;
Default: balabala;
//System.exit(1);
}
- Conditional expressions
Y=(x>0)?1:-1;
- op precedence
1==1^1&&1||1
- Math:ceil,floor, rint , round
6.char:
(int)char
isUpperCase
toLowerCase
When reading a char,using nextLine(),and use line.charAt(0);
- String
S1.charAt(1)
S1.concat(s2) <=>s3=s1+s2 (‘a’,2,+= is OK )
S1.equalsIgnoreCase(s2)
S1.compareToIgnoreCase(s2)
S1.endsWith(suffix2)
S1.contains(s2)
S1.substring(0,1) not include 1;
S1.indexOf(ch,fromIndex)
S1.lastIndexof(S,fromIndex)
X=Integer.parseInt(s1); converting to int
- formatting output
System.out.printf(“%4.2f”,x);
- Passing arguments of functions
Swap :hard to implement
Array is ok;
- Array:int[] A = new int[100];
Int[][] dis= new int[5][5];
A.length
For(int t:a){}
A1=a2;
Function with array Print(int[] array) print(new int[]{1,2,3})
Variable length arg func printMax(double... number)
Arrays.sort(a)
Arrays.binarySearch(a,11)
Arrays.equals(a1,a2)
Arrays.fill(a1,5)
- Class
toString
Constructor
It’s Reference type
Static :class variable
Public: without it,the method can be only used in the package.
Private:”encapsulation” using set&&get function to modify
Protected:access by subclass in another package;
OBJECTIVE THINKING
Extends:
Super() :constructor
Super.method
- ArrayList
ArrayList<String> ss= new ArrayList<>(Arrays.asList(a));
Ss.size();ss.add(“A”);ss.indexOf(“A”);ss.get(0);ss.remove(“A”);ss.isEmpty();
Collections.sort(list);Collections.max(list);
- throw:
public void method()
Throw Exception1,Exception2...
IllegalArgumentException ex= new IllegalArgumentException(“wrong arg”);
Throw ex;
Try
Catch
- File Class
File file=new FILE(“input.txt”)
File.length();
File.exists();
PrintWriter output=new PrintWriter(filename);
Output.print();
Scanner input=new Scanner(file);
JAVA期末考试整理的更多相关文章
- Java期末考试冲刺总结
经过长达将近三个小时的冲刺,我感觉身心俱疲,但它无法掩盖我敲代码的欲望! 三个小时我只实现了公文流转系统的的部分功能. 我深刻的意识到建民老师说的这套关系之复杂,它真的是太复杂了!!!没有系统的梳理, ...
- java 期末考试复习
//Scanner这样写? Scanner input = new Scanner(System.in); //不断获得下一个单词 names[i] = toTitleCase(input.nex ...
- java期末考试
水仙花数 package txt; public class shuixianhua { public static void main(String[] args) { // TODO Auto-g ...
- Java期末考试编程题复习
在程序中定义Person类,为该类编写如下字段.构造器.访问器.修改器和相应的其他方法.(20分) <1>在Person类中定义两个字段: 私有访问权限,类型为String的name字段: ...
- Java 期末考试
一: 题目:打印出100-999之间所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数本身. 例如:153是一个"水仙花 ...
- Java开发工程师(Web方向) - 03.数据库开发 - 期末考试
期末考试 编程题 本编程题包含4个小题,覆盖知识点从基础的JDBC.连接池到MyBatis. 1(10分) 有一款在线教育产品“天天向上”主要实现了在手机上查看课程表的功能.该产品的后端系统有一张保存 ...
- 中国MOOC_面向对象程序设计——Java语言_期末考试编程题_1细胞自动机
期末考试编程题 返回 这是期末考试的编程题 温馨提示: 1.本次考试属于Online Judge题目,提交后由系统即时判分. 2.学生可以在考试截止时间之前提交答案,系统将取其中的最高分作为最终成 ...
- 中国MOOC_零基础学Java语言_期末考试的编程题_1二进制的前导的零
期末考试的编程题 返回 这是期末考试的编程题,在60分钟内,你可以多次提交,直到正确为止. 温馨提示: 1.本次考试属于Online Judge题目,提交后由系统即时判分. 2.学生可以在考试截止 ...
- 复旦大学2015--2016学年第二学期高等代数II期末考试情况分析
一.期末考试成绩班级前几名 胡晓波(90).杨彦婷(88).宋卓卿(85).唐指朝(84).陈建兵(83).宋沛颖(82).王昊越(81).白睿(80).韩沅伯(80).王艺楷(80).张漠林(80) ...
随机推荐
- MySQL技术内幕读书笔记(六)——索引与算法之全文索引
全文索引 概述 通过索引字段的前缀进行查找,B+树索引是支持的,利用B+树索引就可以进行快速查询. SELECT * FROM blog WHERE content like 'xxx%'; ...
- MySql 三大知识点——索引、锁、事务
1. 索引 索引,类似书籍的目录,可以根据目录的某个页码立即找到对应的内容. 索引的优点:1. 天生排序.2. 快速查找.索引的缺点:1. 占用空间.2. 降低更新表的速度. 注意点:小表使用全表扫描 ...
- Linux将yum源设置为阿里云的镜像源
第一步:备份原有镜像源 mv /etc/yum.repo.d/Centos-Base.repo /etc/yum.repo.d/Centos-Base.repo.bak 第二步:下载阿里云的镜像源 w ...
- nginx 的一些优化
一般来说 nginx 配置文件中对优化比较有作用的为以下几项: worker_processes 8; nginx 进程数,建议按照 cpu 数目来指定,一般为它的倍数. worker_cpu_aff ...
- 180510.最近踩过和听过的sql的坑
1. in的巨坑 CREATE TABLE #tmp1 (id INT, value int) CREATE TABLE #tmp2 (id1 INT, value int) ,),(,),(,) , ...
- 关于azkaban上传job压缩包报错问题的解决方案
在azkaban上传job压缩包如果出现 installation Failed Error Chunking during uploading files to db.. 错误,可通过如下方法解决. ...
- windows 端口被占用,并杀死进程的方法
netstat -ano | findstr 8081 查询端口 被什么进程占用 tasklist | findstr 2184 根据进程号 查询任务名称 taskkill /f /t /im jav ...
- CentOS安装和配置Apache(httpd)
1. 安装httpd yum install httpd #安装apache 2. 启动httpd systemctl start httpd.service #启动apache 3. 随服务器自启动 ...
- 抖音圈圈乐 系统搭建H5微信小游戏圈圈乐系统介绍
网红线下游戏抖音圈圈乐改造而来 一.搭建此系统需要准备如下资料: 1. 认证微信服务号 2. 微信支付商户号 3. 备案域名及云服务器 二.系统功能简介: 1. 游戏闯关 2. 每个商品闯关难度后台自 ...
- c#判断是否有网络
//调用操作系统API [System.Runtime.InteropServices.DllImport("wininet")] private extern static bo ...