当前位置:网站首页>Interview questions - Supplement of Huawei computer test knowledge points
Interview questions - Supplement of Huawei computer test knowledge points
2022-06-09 16:55:00 【opopmmm?】
HJ1 The length of the last word in the string
while(sc.hasNextLine()
Scanner、sc.hasNext() Method
What is? Scanner?next() and hasNext() ? nextLine() and hasNextLine()?
line = line.substring(line.lastIndexOf(" ")+1);
String class substring Method
lastIndexOf Usage of
HJ2 Count the number of occurrences of a character
Pattern compile = Pattern.compile(ch,Pattern.CASE_INSENSITIVE);
Matcher matcher = compile.matcher(str);
while(matcher.find()
Pattern.compile Function usage
JAVA Regular expressions :Pattern Class and Matcher Class explanation ( turn )
JAVA Regular expressions ,matcher.find() and matcher.matches() The difference between
char[] arrs = str.toCharArray();
HJ5 Hexadecimal conversion
String str = sc.nextLine().substring(2);
System.out.println(Integer.parseInt(str,16));
substring(int a, int b) Method can truncate a string , When there is only one parameter , The intercept range is 【a,length-1】, When there are two parameters , The intercept range is 【a,b-1】.
Integer.parseInt(String s, int a) Method can convert base , Convert string to "a" Base number , There is only one parameter s when , Convert me 10 Base number .
HJ8 Consolidated statement records
for(Map.Entry<Integer,Integer> integerIntegerEntry : map.entrySet()){
System.out.println(integerIntegerEntry.getKey()+" "+integerIntegerEntry.getValue());
}
Summary enhanced traversal :for,list,map,set
TreeMap Detailed introduction
HJ9 Extract non duplicate integers
// Reverse order
StringBuilder stringBuilder = new StringBuilder(sc.nextLine()).reverse();
String str = stringBuilder.toString();
// Result set
StringBuilder result = new StringBuilder();
for(int i = 0; i < str.length(); i++){
if(str.indexOf(str.charAt(i)) == i){
result.append(str.charAt(i));
}
}
System.out.println(result.toString());
Java in String、StringBuffer、StringBuilder and toString Introduction to
indexOf(String.indexOf Method )
HJ10 Character count
set.stream().filter(c->Integer.valueOf(c) >= 0
&&
Integer.valueOf(c) <= 127).collect(Collectors.toSet()
);
java list.stream().map().collect(Collectors.toList())
lambda expression ,stream、filter、collect、set、limit、findFirst、Map、mapToInt、Distinct、sort、sorted、assertEquals
HJ11 The numbers are upside down
System.out.println(new StringBuffer(String.valueOf(number)).reverse());
String.valueOf() Use of methods
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int num = Integer.parseInt(bf.readLine());
String s = num + "";// Convert to string
边栏推荐
- Experience sharing in application for assessment of doctor of management - Information Collection
- Apple wins us judge dismisses iPhone and iPad security defect class action
- Chapter I Introduction to esql
- Still building projects from scratch? This upgraded rapid development scaffold is worth a try~
- kali-内网穿透上线shell
- SBIO | 浙大陈云组综述农业中细菌与真菌的互作机制
- Redis进阶知识点(可学习,可复习,可面试)
- 冰峰上市IPO,能冲破“本地品牌”的束缚吗?
- Zhongyuan bank unified log platform
- 代码。。。。
猜你喜欢

ue4 bsp画刷中光源需要重建(x未构建对象)

Attack and defense world (WEB) --web_ php_ include

Kali intranet penetration shell

【华东师范大学】初试复试考研资料分享

DZ plug-in - free DZ plug-in collection of all plug-in functions

Experience sharing in application for assessment of doctor of management - Information Collection

With so many universities, the number of people taking the postgraduate entrance examination has risen sharply! Up to 70%!

A poor 150 yuan rce safe SRC excavation

运维思考 | 你知道CMDB与监控是什么关系吗?

MDK 5.37 error: unknown register name ‘control‘ 和 Error: C9932E: Cannot obtain license for Compiler
随机推荐
管理学博士申请考核经验分享——信息收集篇
After the change of beauty brands and consumer demand, how can retailers not fall behind?
Cesium draw fence
Why can't Google search page infinite?
Ppt icon download
Esql, this article is well written
UEditor图片跨域上传解决方案
Can Bingfeng's IPO break through the shackles of "local brands"?
Use testeract to recognize text in pictures
TS compilation configuration
How can we sustain a valuation of 60billion yuan for tea lovers who like the new and hate the old?
Sbio | Chenyun group of Zhejiang University Review on the interaction mechanism between bacteria and fungi in agriculture
『忘了再学』Shell基础 — 28、AWK中条件表达式说明
Laravel8 framework seven cattle cloud upload
10 questions that must be asked in software testing interview
干货|移动端App自动化之触屏操作自动化
Browser fingerprint interpretation
【经验分享】Django开发中常用到的数据库操作总结
Top level templates (including contract, tender, graduation defense and other templates in all aspects of work)
The applet modifies the data of the previous page