本文整理匯總了Java中java.util.InputMismatchException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java InputMismatchException.printStackTrace方法的具體用法?Java InputMismatchException.printStackTrace怎麽用?Java InputMismatchException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.InputMismatchException
的用法示例。
在下文中一共展示了InputMismatchException.printStackTrace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: load
import java.util.InputMismatchException; //導入方法依賴的package包/類
public boolean load(String filename, boolean eraseOld) {
try {
Scanner s = new Scanner(new BufferedReader(new FileReader(filename)));
if (eraseOld) deleteFullGraph();
graph.load(s);
if (TextureEditor.GL_ENABLED) TextureEditor.INSTANCE.m_OpenGLPreviewPanel.load(s);
repaint();
return true;
} catch (FileNotFoundException e) {
Logger.logError(this, "Could not load " + filename);
return false;
} catch (InputMismatchException ime) {
ime.printStackTrace();
Logger.logError(this, "Could not load " + filename);
return false;
}
}
示例2: main
import java.util.InputMismatchException; //導入方法依賴的package包/類
public static void main(String[] args)
{
new cSuper();
Scanner question = new Scanner(System.in);
{
Person eu = new Person("Jozadaque", 21);
System.out.println("My name is: msg = " + "[ msg = " + eu.getName() + " ]");
}
/* Gives me an error, because the object eu was destroyed =D
* eu.getMessage();
*/
try {
System.out.print("Choose a number between 0 - 10: ");
System.out.println(questionReview(question.nextInt()));
} catch(InputMismatchException e) {
e.printStackTrace();
System.err.println("\n*Motivo: Voce entrou com um valor não numérico!");
}
}
示例3: MultiPolygon
import java.util.InputMismatchException; //導入方法依賴的package包/類
/**
* constructor reads file to create a multiPolygon
* @param file the file of the multipolygon
* @throws FileNotFoundException when the file is not found
*/
public MultiPolygon(File file) throws FileNotFoundException {
input = new Scanner(file);
try{
nHoles = input.nextInt();
int nPoints = input.nextInt();// number of points of the polygon that is
// currently being read (this value
// changes when holes are read too)
// used for autoscaling in drawtool
double readX;
double readY;
outerPolygon = new Coordinate[nPoints];
holes = new Coordinate[nHoles][];
for (int i = 0; i < nPoints; i++) {
readX = input.nextDouble();
readY = input.nextDouble();
outerPolygon[i] = new Coordinate(readX, readY);
//-----------------------------------------------------
//values used for scaling in gui
if (readX > biggestX)
biggestX = readX;
else if(readX < smallestX)smallestX = readX;
if (readY > biggestY)
biggestY = readY;
else if(readY < smallestY)smallestY = readY;
//-----------------------------------------------------
}
if(checkClockwise(outerPolygon)){
changeClockOrientation(outerPolygon);
}
for (int i = 0; i < nHoles; i++) {
nPoints = input.nextInt();
holes[i] = new Coordinate[nPoints];
for (int j = 0; j < nPoints; j++) {
holes[i][j] = new Coordinate(input.nextDouble(), input.nextDouble());
}
if(!checkClockwise(holes[i])){
changeClockOrientation(holes[i]);
}
}
input.close();
// now we will make the edge arrays
// this array contains the same information but in pairs of coordinates
// to allow an easier way to use edges
createEdges();
}catch(InputMismatchException e){
System.err.println("the input file is not correct");
e.printStackTrace();
}
}