这个问题在这里已经有了答案:ClosingApplications(5个回答)关闭8年前。System.exit(0);的C#等效项是什么?谢谢 最佳答案 如果您使用的是控制台应用程序-Environment.Exit(exitCode);否则,如果您使用的是基于Windows窗体的应用程序-Application.Exit();礼貌:http://www.dreamincode.net/forums/topic/273503-java-systemexit0%3B-equivalent-in-c%23/
我有一个简单的GUI:publicclassMyGUIextendsJFrame{publicMyGUI(){run();}voidrun(){setSize(100,100);setVisible(true);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//maybeanactionlistenerhere}}我想打印这条消息:System.out.println("Closed");当GUI关闭时(按下X时)。我该怎么做? 最佳答案 试试这个。addWindowListener(
我有一个简单的GUI:publicclassMyGUIextendsJFrame{publicMyGUI(){run();}voidrun(){setSize(100,100);setVisible(true);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//maybeanactionlistenerhere}}我想打印这条消息:System.out.println("Closed");当GUI关闭时(按下X时)。我该怎么做? 最佳答案 试试这个。addWindowListener(
谁能帮我解决以下错误。当我清理项目时,它没有显示任何错误,但每次我尝试运行时都会收到此消息。错误:任务':app:dexDebug'执行失败。com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:Process'command'C:\ProgramFiles\Java\jdk1.8.0_45\bin\java.exe''finishedwithnon-zeroexitvalue2应用程序运行时没有错误,但是当我的系统崩溃并重新启动androidstudio时,我
谁能帮我解决以下错误。当我清理项目时,它没有显示任何错误,但每次我尝试运行时都会收到此消息。错误:任务':app:dexDebug'执行失败。com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:Process'command'C:\ProgramFiles\Java\jdk1.8.0_45\bin\java.exe''finishedwithnon-zeroexitvalue2应用程序运行时没有错误,但是当我的系统崩溃并重新启动androidstudio时,我
问题:我在运行一个程序时候出现了出现了bugerror:command‘\XXX\VS2015\VC\BIN\x86_amd64\link.exe‘failedwithexitstatus1158后缀为1158的错误解决方案因为之前的一些系统配置没了,重新安装例如vs,buildTools之类的东西,但是在安装过程中出现了许多问题,总是缺少东西,这里记录一下不好找的内容。程序运行时提示error:command‘\XXX\VS2015\VC\BIN\x86_amd64\link.exe‘failedwithexitstatus1158后台显示我翻阅网上的解决方案,就是vs缺少了两个文件rc.e
我真的很沮丧解决我的问题,我有一个使用相机的应用程序,当相机拍摄照片时,它会显示在Activity中,当我不使用cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,mPhotoUri);照片将显示在Activity中,但名称和路径文件与我想要的不一样。我正在使用Galaxy选项卡进行编译,我已按照教程从here解决我的问题,here和here但我的应用程序仍然强制关闭并出错,这是我的代码:{FilesdCard=Environment.getExternalStorageDirectory();Filepath=newFile(sdCard.ge
我真的很沮丧解决我的问题,我有一个使用相机的应用程序,当相机拍摄照片时,它会显示在Activity中,当我不使用cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT,mPhotoUri);照片将显示在Activity中,但名称和路径文件与我想要的不一样。我正在使用Galaxy选项卡进行编译,我已按照教程从here解决我的问题,here和here但我的应用程序仍然强制关闭并出错,这是我的代码:{FilesdCard=Environment.getExternalStorageDirectory();Filepath=newFile(sdCard.ge
考虑这个函数:publicbooleanfoo(){System.exit(1);//Thelinesbeyondthiswillnotbereadintbar=1;//L1//Butthereturnstatementisrequiredforsyntacticallycorrectcodereturnfalse;//L2//errorhereforunreachablecode//intunreachable=3;//L3}谁能解释一下为什么L1和L2明显不可访问不会发出警告,而L3会发出警告。 最佳答案 因为就编译器而言,Sy
考虑这个函数:publicbooleanfoo(){System.exit(1);//Thelinesbeyondthiswillnotbereadintbar=1;//L1//Butthereturnstatementisrequiredforsyntacticallycorrectcodereturnfalse;//L2//errorhereforunreachablecode//intunreachable=3;//L3}谁能解释一下为什么L1和L2明显不可访问不会发出警告,而L3会发出警告。 最佳答案 因为就编译器而言,Sy