Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
public static void main(String[] args) throws IOException {
BufferedReader inputStream = null;
try {
inputStream =
new BufferedReader(new FileReader("D:/xanadu.txt"));
String l;
while ((l = inputStream.readLine()) != null) {
Scanner s = new Scanner(l).useDelimiter(",\\s*");
System.out.println(s.nextInt());
System.out.println(s.nextInt());
System.out.println(s.next());
System.out.println(s.next());
s.close();
}
} finally {
if (inputStream != null) {
inputStream.close();
}
}
}
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner s = null;
try {
s = new Scanner(new File("D:/xanadu.txt"));
s.useDelimiter(",\\s*");
System.out.println(s.nextInt());
System.out.println(s.nextInt());
System.out.println(s.next());
System.out.println(s.next());
} catch (IOException e) {
// file bestaat niet
System.out.println(e.getMessage());
} catch (NoSuchElementException e) {
System.out.println("file klopt niet");
} finally {
if (s != null) {
s.close();
}
}
}
}
int[a][b][c][0], int[a][b][c][1], int[a][b][c][2], int[a][b][c][3], int[a][b][c][4]
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
final static int A = 2;
final static int B = 3;
final static int C = 4;
final static int D = 2;
public static void main(String[] args) {
int[][][][] array = new int[A][B][C][D];
System.out.println("Array =");
for (int a = 0; a < A; a++) {
for (int b = 0; b < B; b++) {
for (int c = 0; c < C; c++) {
for (int d = 0; d < D; d++) {
int getal = d + c*10 + b*100+ a*1000;
System.out.print((d == 0 ? "" : ",") + getal);
array[a][b][c][d] = d + c*10 + b*100+ a*1000;
}
System.out.println();
}
}
}
try {
PrintWriter writer = new PrintWriter(new File("C:\\test.txt"));
for (int a = 0; a < array.length; a++) {
for (int b = 0; b < array[a].length; b++) {
for (int c = 0; c < array[a][b].length; c++) {
for (int d = 0; d < array[a][b][c].length; d++) {
writer.print((d == 0 ? "" : ",") + array[a][b][c][d]);
}
writer.println();
}
}
}
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("File =");
try {
Scanner scanner = new Scanner(new File("C:\\test.txt"));
while (scanner.hasNextLine()) {
System.out.println(scanner.nextLine());
}
scanner.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.