1.
1) There is no limit to the length of the entered number, no input number type is defined.
2) code fixed dead input format, and if the judging condition is incomplete
3) public string Getphonenumber (string strphonenum) {
if ((strphonenum==null) | | | "". Equals (Strphonenum)) {
if (Strphonenum.length () ==15) {
for (int a=0;a<15;a++) {
true = Strphonenum.substring (5, 12);
}
Return ' true ';}
}else{
Return ' false ';
SYSTEM.OUT.PRINTLN ("Input Error! ");
}
String[] Arrphone=strphonenum.split ("-");
return arrphone[1];
}
2. (1)
Package WJZ;
public class ArraySort {
Public int[] Sort (int[] a) {//Create ArraySort method
for (int i=0;i<a.length;i++) {
for (int j=i+1;j<a.length; j + +) {//loop to compare adjacent two numbers within an array of arrays
if (A[i]>a[j]) {
int temp=a[i];
A[I]=A[J];
a[j]=temp;//Select sort from large to small
}
}
}
Return a;//returns the sorted array
}
public static void Main (string[] args) {
TODO auto-generated Method Stub
Int[] i={1,4,5,6,9,11,5,-8,-44,5};
SYSTEM.OUT.PRINTLN ("The result after sorting is:");
ArraySort x = new ArraySort ();
Int[] B=x.sort (i);
for (int a = 0;a<b.length;a++) {
System.out.println (B[a]);
}
}
}
(2) Comparing I and J, if I is larger than J, then it is invariant, conversely, I will be transferred to the front of J, and then the order from large to small can be obtained.
(3) I. Array is empty
Two. Some elements in the array are the same
Three. The order of the values of the array has been sorted out
Four. All values in the array are equal
Five. The order in the array is reversed
Third Blog Job