1 一个整数的各位数字之和能被 9 整除,则该数也能被 9 整除。编程验证给
定的整数能否被 9 整除。
package dodoke;
import java.util.Random;
public class Day22 {
public static void panduan(int num){
int b=num/100; //百位数
int s=num%100/10; //十位数
int g=num%10; //个位数
if(num%9==0){
System.out.println(num+"能被9整除");
if((b+s+g)%9==0){
System.out.println("同时"+num+"的各个位数之和也能被9整除");
}
else{
System.out.println("但是"+num+"的各个位数之和不能被9整除");
}
}
else
System.out.println("next test!");
}
public static void main(String[] args) {
Random rd=new Random();
int shu=10+rd.nextInt(90);
shu =shu *9;
panduan(shu);
}
2 请简述AJAX 及基本步骤?
初始化ajax对象
连接地址,准备数据
发送请求
接收数据(正在接收,尚未完成)
接受数据完成
3.一个6亿的表a,一个3亿的表b,通过外间tid关联,你如何最快的查询出满足条件的第50000到第50200中的这200条数据记录。
1、如果A表TID是自增长,并且是连续的,B表的ID为索引
select * from a,b where a.tid = b.id and a.tid>500000 limit 200;
2、如果A表的TID不是连续的,那么就需要使用覆盖索引.TID要么是主键,要么是辅助索引,B表ID也需要有索引。
select * from b , (select tid from a limit 50000,200) a where b.id = a .tid;