导航:首页 > 编程语言 > java前进几格

java前进几格

发布时间:2023-07-24 22:54:51

java格式

红色是类名(不是你定义的,而是原来就有的,比如Exception),至于怎么排列,不关事,只要有就可以,比如class test {}都可以,格式化代码事为了方便

② 求个简单点的Java程序 100行左右。 需要解释。

XSSFWorkbook xwb = new XSSFWorkbook(excel);
XSSFSheet sheet = xwb.getSheetAt(0);
for (int i = sheet.getFirstRowNum() + 1; i <= sheet.getPhysicalNumberOfRows(); i++) {
XSSFRow row = sheet.getRow(i);
if (row != null) {
//metaID
XSSFCell cell0 = row.getCell(0);
if (null == cell0) {
throw new Exception("唯一标识MetaID不能为空!");
}
// 中文标题
XSSFCell cell1 = row.getCell(1);
if (null == cell1) {
throw new Exception("标题不能为空!");
}
// StatutesTitle
XSSFCell cell2 = row.getCell(2);
if (null == cell2) {
throw new Exception("StatutesTitle不能为空!");
}
//StatutesTitle
XSSFCell cell3 = row.getCell(3);
if (null == cell3) {
throw new Exception("法律部门不能为空!");
}
//LegalDepartment
XSSFCell cell4 = row.getCell(4);
if (null == cell4) {
throw new Exception("LegalDepartment不能为空!");
}
//发布部门英文
XSSFCell cell5 = row.getCell(5);
if (null == cell5) {
throw new Exception("发布部门不能为空!");
}
//IssuingDepartment
XSSFCell cell6 = row.getCell(6);
if (null == cell6) {
throw new Exception("IssuingDepartment不能为空!");
}
//发布机构类型
XSSFCell cell7 = row.getCell(7);
if (null == cell7) {
throw new Exception("发布机构类型不能为空!");
}
//IssuingOrganizationType
XSSFCell cell8 = row.getCell(8);
if (null == cell8) {
throw new Exception("IssuingOrganizationType不能为空!");
}

//批准部门
XSSFCell cell9 = row.getCell(9);

//ApprovalDepartment
XSSFCell cell10 = row.getCell(10);

//通过/批准日期
XSSFCell cell11 = row.getCell(11);

//ApprovalDate
XSSFCell cell12 = row.getCell(12);

//发布文号
//TODO 有则必填??
XSSFCell cell13 = row.getCell(13);
//DispatchNo
XSSFCell cell14 = row.getCell(14);

//公布/发布日期
XSSFCell cell15 = row.getCell(15);
if (null == cell15) {
throw new Exception("公布/发布日期不能为空!");
}
//ReleaseDate
XSSFCell cell16 = row.getCell(16);
if (null == cell16) {
throw new Exception("ReleaseDate不能为空!");
}

//施行日期
XSSFCell cell17 = row.getCell(17);
if (null == cell17) {
throw new Exception("施行日期不能为空!");
}
//ImplementationDate
XSSFCell cell18 = row.getCell(18);
if (null == cell18) {
throw new Exception("ImplementationDate不能为空!");
}
//废止日期
XSSFCell cell19 = row.getCell(19);

//AbolitionDate
XSSFCell cell20 = row.getCell(20);

//历史沿革
XSSFCell cell21 = row.getCell(21);

//HistoricalDevelopment
XSSFCell cell22 = row.getCell(22);

//时效性
XSSFCell cell23 = row.getCell(23);
if (null == cell23) {
throw new Exception("时效性不能为空!");
}
//Timeliness
XSSFCell cell24 = row.getCell(24);
if (null == cell24) {
throw new Exception("Timeliness不能为空!");
}

//效力级别
XSSFCell cell25 = row.getCell(25);
if (null == cell25) {
throw new Exception("效力级别不能为空!");
}
//EffectivenessGrade
XSSFCell cell26 = row.getCell(26);
if (null == cell26) {
throw new Exception("EffectivenessGrade不能为空!");
}

//来源
XSSFCell cell27 = row.getCell(27);
if (null == cell27) {
throw new Exception("来源不能为空!");
}
//SourceName
XSSFCell cell28 = row.getCell(28);
if (null == cell28) {
throw new Exception("SourceName不能为空!");
}

//地域
XSSFCell cell29 = row.getCell(29);
if (null == cell29) {
throw new Exception("地域不能为空!");
}
//Areas
XSSFCell cell30 = row.getCell(30);
if (null == cell30) {
throw new Exception("Areas不能为空!");
}

//年度
XSSFCell cell31 = row.getCell(31);
if (null == cell31) {
throw new Exception("年度不能为空!");
}
//Year
XSSFCell cell32 = row.getCell(32);
if (null == cell32) {
throw new Exception("Year不能为空!");
}

//主题分类
XSSFCell cell33 = row.getCell(33);
if (null == cell33) {
throw new Exception("主题分类不能为空!");
}
//InstryClassification
XSSFCell cell34 = row.getCell(34);
if (null == cell34) {
throw new Exception("InstryClassification不能为空!");
}

//学科分类
XSSFCell cell35 = row.getCell(35);
if (null == cell35) {
throw new Exception("学科分类不能为空!");
}
//SubjectCategory
XSSFCell cell36 = row.getCell(36);
if (null == cell36) {
throw new Exception("SubjectCategory不能为空!");
}

//中图法分类
XSSFCell cell37 = row.getCell(37);
if (null == cell37) {
throw new Exception("中图法分类不能为空!");
}
//CLC
XSSFCell cell38 = row.getCell(38);
if (null == cell38) {
throw new Exception("CLC不能为空!");
}

//案由
XSSFCell cell39 = row.getCell(39);

//CauseOfAction
XSSFCell cell40 = row.getCell(40);

//程序
XSSFCell cell41 = row.getCell(41);
if (null == cell41) {
throw new Exception("程序不能为空!");
}
//Procere
XSSFCell cell42 = row.getCell(42);
if (null == cell42) {
throw new Exception("Procere不能为空!");
}

//编辑提示
XSSFCell cell43 = row.getCell(43);

//EditPrompt
XSSFCell cell44 = row.getCell(44);

//字数
XSSFCell cell45 = row.getCell(45);

//words
XSSFCell cell46 = row.getCell(46);

//试读比例(字数)
XSSFCell cell47 = row.getCell(47);
if (null == cell47) {
throw new Exception("试读比例(字数)不能为空!");
}
//Previews
XSSFCell cell48 = row.getCell(48);
if (null == cell48) {
throw new Exception("Previews不能为空!");
}

//文件路径
XSSFCell cell49 = row.getCell(49);
if (null == cell49) {
throw new Exception("文件路径不能为空!");
}
//PathFile
XSSFCell cell50 = row.getCell(50);
if (null == cell50) {
throw new Exception("PathFile不能为空!");
}

//资源类型
XSSFCell cell51 = row.getCell(51);
if (null == cell51) {
throw new Exception("资源类型不能为空!");
}
//ResourceType
XSSFCell cell52 = row.getCell(52);
if (null == cell52) {
throw new Exception("ResourceType不能为空!");
}

//价格
XSSFCell cell53 = row.getCell(53);
if (null == cell53) {
throw new Exception("价格不能为空!");
}
//Eprice
XSSFCell cell54 = row.getCell(54);
if (null == cell54) {
throw new Exception("Eprice不能为空!");
}

String metaID = cell0.toString();
String statutesTitle = cell1.toString();
String legalDepartment = cell3.toString();
String issuingDepartment = cell5.toString();
String issuingOrganizationType = cell7.toString();
String approvalDepartment = cell9.toString();
String approvalDepartmentEn = cell10.toString();
String approvalDate = cell11.toString();
String approvalDateEn = cell12.toString();
String dispatchNo = cell13.toString();
String dispatchNoEn = cell14.toString();
String releaseDate = cell15.toString();
String releaseDateEn = cell16.toString();
String implementationDate = cell17.toString();
String implementationDateEn = cell18.toString();
String abolitionDate = "";
String abolitionDateEn = "";
if(cell19 != null){
abolitionDate = cell19.toString();
}
if(cell20 != null){
abolitionDateEn = cell20.toString();
}
String historicalDevelopment = "";
String historicalDevelopmentEn = "";
if(cell21!= null){
historicalDevelopment = cell21.toString();
}
if(cell22 != null){
historicalDevelopmentEn = cell22.toString();
}
String timeliness = cell23.toString();
String effectivenessGrade = cell25.toString();
String sourceName = "";
String sourceNameEn = "";
if(cell25 != null){
sourceName = cell25.toString();
}
if(cell26 != null){
sourceNameEn = cell26.toString();
}
String areas = cell27.toString();
String year = cell29.toString();
String subjectClassify = cell31.toString();
String instryClassification = cell33.toString();
String subjectCategory = cell35.toString();
String clc = cell37.toString();
String causeOfAction = "";
String causeOfActionEn = "";
if(cell39 != null){
causeOfAction = cell39.toString();
}
if(cell40 != null){
causeOfActionEn = cell40.toString();
}
String procere = cell41.toString();
String editPrompt = "";
String editPromptEn = "";
if(cell43 != null){
editPrompt = cell43.toString();
}
if(cell44 != null){
editPromptEn = cell44.toString();
}
String words = "";
String wordsEn = "";
if(cell45 != null){
words = cell45.toString();
}
if(cell46 != null){
wordsEn = cell46.toString();
}
String preViews = cell47.toString();
String pathFile = cell49.toString();
String resourceType = cell51.toString();
String eprice = cell53.toString();
String epriceEn = cell54.toString();

//给入库赋值
storage.setProctMetaId(metaID);
storage.setProctTitle(statutesTitle);
storage.setProctTitleEn(statutesTitle);
storage.setProctIssuingDepart(issuingDepartment);
storage.setProctIssuingDepartEn(issuingDepartment);
storage.setProctLegalDepartment(legalDepartment);
storage.setProctLegalDepartmentEn(legalDepartment);
storage.setProctIssuingOType(issuingOrganizationType);
storage.setProctIssuingOTypeEn(issuingOrganizationType);
storage.setProctApprovalDepart(approvalDepartment);
storage.setProctApprovalDeparttEn(approvalDepartmentEn);
storage.setProctApprovalDate(approvalDate);
storage.setProctApprovalDateEn(approvalDateEn);
storage.setProctDispatchNo(dispatchNo);
storage.setProctDispatchNoEn(dispatchNoEn);
storage.setProctReleaseDate(releaseDate);
storage.setProctReleaseDateEn(releaseDateEn);
storage.setProctImplementDate(implementationDate);
storage.setProctImplementDateEn(implementationDateEn);
storage.setProctAbolitionDate(abolitionDate);
storage.setProctAbolitionDateEn(abolitionDateEn);
storage.setProctHistoricalDevelop(historicalDevelopment);
storage.setProctHistoricalDevelopEn(historicalDevelopmentEn);
storage.setProctTimeliness(timeliness);
storage.setProctTimelinessEn(timeliness);
storage.setProctEffectivenessGrade(effectivenessGrade);
storage.setProctEffectivenessGradeEn(effectivenessGrade);
storage.setProctSourceName(sourceName);
storage.setProctSourceNameEn(sourceNameEn);
storage.setProctAreas(areas);
storage.setProctAreasEn(areas);
storage.setProctYear(year);
storage.setProctYearEn(year);
storage.setProctSubjectClass(subjectClassify);
storage.setProctSubjectClassEn(subjectClassify);
storage.setProctInstryClassifica(instryClassification);
storage.setProctInstryClassificaEn(instryClassification);
storage.setProctSubjectCategory(subjectCategory);
storage.setProctSubjectCategoryEn(subjectCategory);
storage.setProctCLC(clc);
storage.setProctCLCEn(clc);
storage.setProctCauseOfAction(causeOfAction);
storage.setProctCauseOfActionEn(causeOfActionEn);
storage.setProctProcere(procere);
storage.setProctProcereEn(procere);
storage.setProctEditPrompt(editPrompt);
storage.setProctEditPromptEn(editPromptEn);
storage.setProctWords(words);
storage.setProctWordsEn(wordsEn);
storage.setProctPreviews(preViews);
storage.setProctPreviewsEn(preViews);
storage.setProctPathFile(pathFile);
storage.setProctPathFileEn(pathFile);
storage.setProctResourceType(resourceType);
storage.setProctResourceTypeEn(resourceType);
storage.setProctEprice(eprice);
storage.setProctEpriceEn(epriceEn);

this.save(storage);

}
}

③ Java的基本格式

基本格式来:修饰符 class 类名(程序代自码)

意义:Java中的程序代码都必须放在一个类中,对于类初学者可以简单地把它理解为一个java程序;类需要使用class作为关键字定义;而在class的前面可以有一些修饰符。

(3)java前进几格扩展阅读

编写java时,特别需要注意的几个书写格式常见的错误:

1.java中的程序代码中功能执行语句的最后都必须用(;)结束。

这里需要注意的是,在程序中不要将英文的分号(;)误写成中文的分号(;) ,如果写成了中文的分号,编译器会报告“Invalid character”(无效字符)这样的错误信息。

2.Java语言是严格区分大小写的。在定义类时,不能将class写成Class,否则编译会报错。程序中定义一个computer的同时,还可以定义一个Computer,computer和Computer是两个全完不同的符号,在使用的时候需要注意。

3. 在编写java代码的时候为了便于阅读,通常会使用一种良好的格式进行排版,但这并不是必须的,我们也可以在两个单词或者符号之间任意换行。

阅读全文

与java前进几格相关的资料

热点内容
win10点击文件夹声音消失 浏览:963
苹果手机空白文件名 浏览:833
linuxmv覆盖合并文件夹 浏览:932
不开访客网络怎么联网 浏览:631
win10的软件卸载 浏览:779
crv汽车自带网络怎么打开 浏览:973
食品原材料到什么网站购买 浏览:649
一年级的小孩子学编程怎么样 浏览:863
ic考勤机怎么导出数据 浏览:922
网站设计编程如何开始学习 浏览:749
淘宝代码隐藏导航不见了 浏览:7
macbookpro如何修改文件内容 浏览:965
java稳定排序 浏览:53
oppo文件管理的图片 浏览:335
plc编程步数怎么计算 浏览:142
ipad看电脑文件 浏览:935
成都制作pdf文件 浏览:735
怎么样点开电脑里面的网络连接 浏览:755
微信怎么退出账号 浏览:32
w微信开发者工具 浏览:325

友情链接