2023-02-21 17:34来源:m.sf1369.com作者:宇宇
您好,嵌入式的门槛和学习难度要大于java,所以嵌入式更难。但是,嵌入式开发的整体工资水平不如java,很多做javaEE开发的一年工作经验在一线城市能拿到6-8K,两年经验上万的也不少。而做嵌入式的只有极少数能在一两年内达到这个水平。
import java.io.BufferedReader;
import java.io.FileReader;
public class Test {
private String file = null;
public Test(String file) {
this.file = file;
}
public StringBuilder check(String user, String project) throws Exception {
String prefix = user.trim() + + project.trim();
StringBuilder sb = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader(file));
String s = null;
while ((s = in.readLine()) != null) {
s = s.trim();
if (s.startsWith(prefix)) {
sb.append(评分为:
+ s.substring(prefix.length(), s.lastIndexOf( )).trim()
+ \n);
}
}
} catch (Exception e) {
if (in != null)
in.close();
}
return sb;
}
public static void main(String[] args) throws Exception {
Test t = new Test(文件路径,比如D:/u.data);
System.out.println(t.check(输入用户号, 项目号));
}
}
J2SE 没有。
但是可以使用 json-lib 包里面的工具类。
这个是文本流,先把文本读到内存中,再根据固定的格式去解析。按照换行解析
Listlist=new ArrayList(); String encoding = GBK; File file = new File(c:/test.txt); if (file.isFile() && file.exists()) { InputStreamReader read = new InputStreamReader( new FileInputStream(file), encoding); BufferedReader bufferedReader = new BufferedReader(read); String lineTXT = null; while ((lineTXT = bufferedReader.readLine()) != null) { String [] stuAttr=lineTXT.toString().split(,); Student student=new Student(); //解析stuAttr数组封装Student对象 list.add(student); } read.close(); }else{ System.out.println(找不到指定的文件!); }
这题太简单了,没有楼上说的那么复杂,假设输入的数字为num
第一个,
String numStr = String.valueOf(Long.valueOf(num));
System.out.println( numStr.length() );
第二个,
for(int i = 0 ;i System.out.print(numStr.substring(i,i+1)+ ); } 第三个 System.out.println(); boolean flag = true; for(int i = numStr.length() -1 ;i >=0 ; i--){ if(flag){ if(numStr.substring(i, i+1).equals(0)){ numStr = numStr.substring(0,i); continue; }else{flag = false;} } System.out.print(numStr.substring(i, i+1)); } 第四个 System.out.println(); int a = (Integer.valueOf(numStr.substring(0,1))%2==0)?0:1; System.out.println(a);
两遍扫描,第一遍扫描b.txt,提取关键字,保存到一个Hash查找表结构中(查找快),第二遍扫描a.txt,在Hash查找表中找出现的元素。