From: Jérôme Benoit Date: Tue, 3 Apr 2018 18:35:13 +0000 (+0200) Subject: exo3: trap the empty class name case properly. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=72fb6b7df1ee25d9e96586fce5d3936527e7fea4;p=Project_POO.git exo3: trap the empty class name case properly. Signed-off-by: Jérôme Benoit --- diff --git a/exo3/Main.java b/exo3/Main.java index f15a4ec..4909568 100644 --- a/exo3/Main.java +++ b/exo3/Main.java @@ -41,7 +41,12 @@ class Main { * @param String[] args main() function arguments array */ public static void main(String[] args) { + if (args.length == 0) { + System.out.println("Please run with java Main "); + System.exit(-1); + } String className = args[0]; + Class cl = null; try { cl = Class.forName(className);