通过Scannerinput实现LocalDateTime(LocalDateTime via Scannerinput)
我需要从
Scanner
插入一个LocalDateTime
。 我们需要使用输入格式dd.MM. HH:mm
对于
Scanner
(不使用额外的变量!),如何将这些扫描值放入起始变量?Scanner sc = new Scanner(System.in); System.out.println("Year:"); int year = sc.nextInt(); System.out.println("Start:"); //--- (?) scan something like dd.MM. HH:mm --- start = LocalDateTime.of(year, month, dayOfMonth, hour, minute)
如果扫描的输入格式
dd.MM. HH:mm
dd.MM. HH:mm
,该程序应该抛出IllegalArgumentException
。 我知道它是如何工作的,所以你知道我们不能使用getsubstring()
和getsubstring()
:(I need to insert a
LocalDateTime
from aScanner
. We are required to use the input formatdd.MM. HH:mm
for the
Scanner
(without using extra variables!), how can I get these scanned values into the start variable?Scanner sc = new Scanner(System.in); System.out.println("Year:"); int year = sc.nextInt(); System.out.println("Start:"); //--- (?) scan something like dd.MM. HH:mm --- start = LocalDateTime.of(year, month, dayOfMonth, hour, minute)
If the scanned input is not in the format
dd.MM. HH:mm
, the program is supposed to throw anIllegalArgumentException
. I know how THAT works, just so you know we can't usesc.next()
and thegetsubstring()
:(
原文:https://stackoverflow.com/questions/35485984
最满意答案
来自Crashlytics的Hemal在这里! 你可以继续尝试安装plugin.zip文件而不是jar,并让我知道这是否有效?
Hemal from Crashlytics here! Can you go ahead and try to install the plugin.zip file instead of the jar and let me know if that works?
相关问答
更多-
Crashlytics Android Studio插件无法初始化(Crashlytics Android Studio plugin fails to initialize)[2022-04-14]
来自Crashlytics的Hemal在这里! 你可以继续尝试安装plugin.zip文件而不是jar,并让我知道这是否有效? Hemal from Crashlytics here! Can you go ahead and try to install the plugin.zip file instead of the jar and let me know if that works? -
迈克从面料这里。 对于没有活动网络连接时发生的构建,我们将映射 - 构建ID对存放在运行构建的机器上。 当您恢复网络连接时,我们上传缓存的数据。 是的,由于每个构建的唯一标识,我们可以将构建与相同的versionCode和versionName区分开来。 这也是为什么你必须小心它的一代:) Mike from Fabric here. For builds that happen when there is no active network connection, we cache the mapping ...
-
在Android Studio的产品风格中使用Crashlytics(Use Crashlytics within a product flavor in Android Studio)[2022-03-02]
有一个类似的问题:我不得不在调试版本中关闭crashlytics的报告。 迈克尔的回答没有帮助我:在我添加了ext.enableCrashlytics = false ,crashlytics在开始时销毁了应用程序。 感谢Github我找到了一个工作的解决方案: 的build.gradle: //... android { buildTypes { debug { // enable crashlytics where you need ... -
我修好了它。 如果我没记错的话,这就是我的尝试: ionic build android (失败) ionic platform remove android cordova platform remove android cordova plugin remove cordova-crashlytics-plugin ./platforms/android/cordova/clean cordova platform add android ionic build android (成功) cordova ...
-
我在这里找到了答案http://support.crashlytics.com/knowledgebase/articles/202140-do-you-support-build-tools-for-android,http https://fabric.io/downloads/gradle I found answer here http://support.crashlytics.com/knowledgebase/articles/202140-do-you-support-build-tools ...
-
您的插件版本可能已过时。 删除旧版本的插件(文件 - 设置 - 插件 - 选择“Android Studio的结构” - 按“卸载插件”)。 从Fabric仪表板下载新版本(在左侧栏上有一个按钮“下载插件”)从磁盘安装插件(文件 - 设置 - 插件 - 按钮“从磁盘安装插件”)。 Your plugin version is probably outdated. Remove the old version of plugin (File - Settings - Plugins - choose "Fab ...
-
Crashlytics:与XML相关的Android Studio Gradle Error(Crashlytics : Android Studio Gradle Error related to XML)[2023-05-18]
来自Fabric的Mike来自这里。 我们发布了一个更新版本的插件,它有一个修复程序。 如果您更新到最新版本,那么这将全部设置。 Mike from Fabric here. We shipped out an updated version of the plugins that has a fix for this. If you update to the latest version then this will be all set. -
来自Fabric和Crashlytics的Mike来自这里。 你的第一个init调用是正确的,但你也可以使用: Fabric.with(this, new CrashlyticsCore(), new Crashlytics()); 或使用: Fabric.with(this, new CrashlyticsCore.getInstance()); 与以下进口: import com.crashlytics.android.Crashlytics; import com.crashlytics.a ...
-
Fabric.with Crashlytics导致Android Studio出现问题(Fabric.with Crashlytics causing issues with Android Studio)[2021-11-10]
我们从不同的计算机安装了结构工具,并且工作正常。 2012 iMac osx 10.10 Android Studio 1.4.1 We installed the fabric tools from a different computer and that worked. 2012 iMac osx 10.10 Android Studio 1.4.1 -
Marc来自Crashlytics这里。 Crashlytics.start()在较新版本的SDK中的后台线程中完成所有繁重工作。 你的日志表明你正在使用v0.9.11。 一旦更新到最新版本(v1.0.4),就可以在应用程序子类中保留Crashlytics.start。 如果您需要更新帮助,请通过crashlytics dot com与我们联系。 Marc from Crashlytics here. Crashlytics.start() does all the heavy lifting in a b ...