˹觶֧Ժ
Home Contents KMArticlesMembersSponsorsAbout us

Ѻا : 2556-09-27 (˹觶֧Ժ)
ͺͺ
print 1 to 10
class x {
public static void main(String args[]){
System.out.println("5\n7\n1\n4\n6\n9\n8\n10\n2\n3");
}
}
// ===
import java.util.Arrays;
class x {
public static void main(String args[]){
int y[] = {5,7,1,4,6,9,8,10,2,3};
System.out.println(Arrays.toString(y));
}
}
// [5, 7, 1, 4, 6, 9, 8, 10, 2, 3]
// ===
import java.util.Arrays;
class x {
public static void main(String args[]){
int y[] = {5,7,1,4,6,9,8,10,2,3};
for (int z: y)
System.out.print(z+ "\n");
}
}
// ===
class x {
public static void main(String args[]){
String y[] = new String[10];
y = ("5,7,1,4,6,9,8,10,2,3").split(",");
for (String z: y)
System.out.print(z+ "\n");
}
}
// ===
import java.util.*;
class x {
public static void main(String args[]){
String y[] = new String[10];
for (int i =0;i<10;i++) {
y[i] = Double.toString(Math.random()) + ","+ Integer.toString(i);
}
Arrays.sort(y);
for (int i =0;i<10;i++) {
System.out.println(y[i].split(",")[1]);
}
}
}
// ===
import java.util.*;
class x {
public static void main(String args[]){
Double y[] = new Double[10];
int i = 0;
for (Double z: y) {
y[i++] = Math.random();
}
Double[] tmp = y.clone();
Arrays.sort(tmp, Collections.reverseOrder());
List l = Arrays.asList(y);
i = 0;
for (Double z: y) {
System.out.println(l.indexOf(tmp[i]));
i++;
}
}
}
// ===
import java.util.*;
class x {
public static void main(String args[]){
Double y[] = new Double[10];
Double tmp[] = new Double[10];
for (int i =0;i<10;i++) {
y[i] = Math.random();
}
tmp = y.clone();
Arrays.sort(y);
List data = Arrays.asList(y);
for (int i =0;i<10;i++) {
System.out.println(data.indexOf(tmp[i]));
}
}
}
// ===
class x{
static int ar[] = new int[10];
public static void main(String a[]) {
  int i = 0;
  while (i < 10){
    if(getv((int)(Math.random() * 10 + 1),i)) { i++; }
  }
}  // end main
static boolean getv(int j,int seq) {
  boolean found = false;
  for (int k=0;k<=seq;k++) {
    if (ar[k] == j) found=true;
  }
  if (found == false){
    ar[seq] = j;
    System.out.println(ar[seq]);
    return true;
  } else {
    return false;
  }
} // end getv
} // end class
"Imagination is more important than knowledge" - Albert Einstein
Home
Thaiabc.com
Thainame.net
Lampang.net
Nation university
PHP
MySQL
Visual basic.NET
TabletPC
Linux
Online quiz
Download
Search engine
Web ranking
Add website
Blog : Education
Blog : ACLA
Blog : Lampang
Facebook.com
Twitter.com
About us
My dream
Site map
Sponsor
http://goo.gl/72BPC