# 面试编程题（一）

package demo.test;

import java.util.Arrays;
import java.util.Scanner;

public class A {
public static void main(String[] args) {
/*//对一串数字排序
int [] intArr={5,9,1,4,2,6,3,14,8,0,7};
//数组排序
Arrays.sort(intArr);
for (int i : intArr) {
System.out.println(i);
}
//选择排序
for(int i =0;i<intArr.length-1;i++){
for (int j = i+1; j < intArr.length; j++) {
if(intArr[i]>intArr[j]){
intArr[i]+=intArr[j];
intArr[j]=intArr[i]-intArr[j];
intArr[i]-=intArr[j];
}
}
}
for (int i : intArr) {
System.out.println(i);
}
//冒泡排序
for(int i =0;i<intArr.length-1;i++){
for (int j = 0; j < intArr.length-i-1; j++) {
if(intArr[j]>intArr[j+1]){
intArr[j]+=intArr[j+1];
intArr[j+1]=intArr[j]-intArr[j+1];
intArr[j]-=intArr[j+1];
}
}
}
for (int i : intArr) {
System.out.println(i);
}*/

/*100以内的质数
for(int i=1;i<=100;i++){
int j=2;
for(;j<=i/2;j++){
if(i%j==0 && i>2){
break;
}
}
if(j>i/2){
System.out.println(i+"是质数");
}
}*/

/*//判断是否是对称数，比如34543，223322
//第一种，换成字符串比较
Scanner scanner = new Scanner(System.in);
System.out.println("请输入一个数：");
String aa = scanner.next();
try {
int a = Integer.valueOf(aa);
} catch (Exception e) {
System.out.println("你输入的不是数字");
return;
}
boolean judge = true;
for (int i = 0; i < aa.length()/2; i++) {
System.out.println(aa.substring(i, i+1));
if(!aa.substring(i, i+1).equals(aa.substring(aa.length()-i-1, aa.length()-i))){
judge=false;
}
}
System.out.println(judge);

//第二种，高低位互换构造一个新的数，与原来的数进行比较
boolean judge = true;
Scanner scanner = new Scanner(System.in);
System.out.println("请输入一个数：");
String number = scanner.next();
scanner.close();
int a=0,b=0;
try {
a = Integer.valueOf(number);
} catch (Exception e) {
System.out.println("你输入的不是数字");
return;
}
for(int temp=a;temp>0;){
b=b*10+temp%10;
temp/=10;
}
if(b!=a){
judge=false;
}
System.out.println(judge);*/
}
}

public class A {
public static void main(String[] args) {
B b = new C();
}
}

class B{
static{
System.out.println("1");
}
public B() {
System.out.println("2");
}
}
class C extends B{
static{
System.out.println("a");
}
public C() {
System.out.println("b");
}
}

public class A {
public static void main(String[] args) {
B b = new C();
b=new C();
}
}

public class A {
public static void main(String[] args) {
B b = new C();
b=new C();
b=new C(110);
}
}

class B{
static{
System.out.println("1");
}
public B() {
System.out.println("2");
}
public B(int num){
System.out.println(num+"1");
}
}
class C extends B{
static{
System.out.println("a");
}
public C() {
System.out.println("b");
}
public C(int num){
System.out.println(num+"a");
}
}

#### 面试常见编程题目

2016-09-26 09:58:03

#### 面试-编程题

2018-01-09 10:58:55

#### java 面试编程题

2009-10-13 14:48:00

#### Python面试--编程题

2017-03-31 18:45:25

#### Unity面试编程题

2017-04-19 02:35:10

#### java面试之常见编程题

2016-06-06 13:44:02

#### 2.前端常见面试编程题整理

2017-07-08 21:09:33

#### 面试笔试整理6：常见面试编程题

2017-09-18 00:36:01

#### 常见的C语言面试编程题（二）

2009-05-20 21:24:00

#### 关于数组的js编程题（面试很常见哦）

2017-01-08 15:21:22