java web week_one
2017-05-19 23:18
351 查看
1.在控制台打印出九九乘法表
public class Jiujiu { public static void main(String[] args) { for (int i = 1; i < 10; i++) { for (int j = 1; j <= i; j++) { System.out.print(i + " x " + j + " = " + i * j + "\t"); if (i == j) { System.out.println(); } } } } }
2.写一个函数用于求出整数数组中的最大值
public class MaxNumber { public static void main(String[] args) { Random random = new Random(); int[] array = new int[10]; for (int i = 0; i < 10; i++) { int num = random.nextInt(10) + 1;//[1,10)之前的数 array[i] = num; } int i; for (i = 0; i < array.length; i++) { System.out.print(array[i] + " "); } if (i == array.length){ System.out.println(); } System.out.println(forMax(array)); } private static int forMax(int[] array) { int max = array[0]; for (int i = 0; i < array.length; i++) { if (max <= array[i]){ max = array[i]; } } return max; } }
4.音乐文件读取工具
public class Music { public static void main(String[] args) { File file = new File("musics"); findMP3(file, file.getAbsolutePath()); } private static void findMP3(File songFile, String songPath) { File[] songList = songFile.listFiles(); if (songList != null) { for (File s : songList) { if (s.isDirectory()) { findMP3(s, s.getAbsolutePath()); } else { if (s.getAbsolutePath().endsWith(".mp3") || s.getAbsolutePath().endsWith("MP3")) { System.out.println(s.getAbsolutePath()); } } } } } }
相关文章推荐
- java web week_three_one
- Dynamic Web Module 3.0 request Java 1.6 or newer---One or more constraints have not been satisfied解决
- Afer one week affort for Java
- java web week two
- WebService analyze part one : build wsdl from java service .
- java web week_five 多线程作业
- java web:At least one JAR was scanned for TLDs yet contained no TLDs.
- 运行 javawebservice 报错 “org.apache.catalina.core.StandardContext.startInternal One or more listeners ”
- Java Web Project 技巧备忘录
- java Web应用配置log4j日志记录
- JavaWeb——B/S,C/S结构,HTTP协议
- [Java爬虫HttpClient_Demo2模拟浏览器并抓取Web图片]
- java取得web工程目录
- 学习JavaWeb之Servlet_Requst
- Java微信公众平台开发(14) 微信web开发者工具使用
- 3月20日 JavaWeb 周二
- 收集几种解决:The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or t
- 我的Java Web作业---计算器作业
- javaweb基础
- Java Web高性能开发(二)