如何编写一个Java代码来检查条件并在条件为真时抛出警告 [英] How do I write a Java code that will check a condition and throw warning when the condition is true

查看:311
本文介绍了如何编写一个Java代码来检查条件并在条件为真时抛出警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上它是一个商店管理独立系统,有产品和客户,店主和批发商以及所有这些东西。因此,我需要一个简单的Java代码(因为我是该语言的新手),它在if条件中检查特定产品的库存限制,并在库存超过给定限制时生成警告。例如,如果RayBan有60个太阳镜,当库存减少到10时,必须生成一个警告,要求补充太阳镜。

Basically it's for a shop management "standalone" system that has products and customers,shopkeeper and wholesaler and all that stuff. So I need a Simple Java code (as I am new to the language) that checks the stock limit of a particular product in an 'if condition' and generates warning when the stock deceeds the given limit. For example, if there are 60 sunglasses of RayBan,when the stock reduces to 10 a warning must be generated asking for restocking of sunglasses.

推荐答案

您可以选择以下方法



使用 Quartz Scheduler API - 此API将帮助在固定的时间间隔内安排活动并拨打您的特定课程应用。



在该类中,您可以编写代码来检查所需条件,并根据该触发器发出警告,如邮件。
You may go with following approach

Use Quartz Scheduler API - This API will help scheduling an event on fixed interval of time and make a call to particular class of your application.

In that Class, you could write a code to check for the required condition and based upon that trigger a warning like mail.


这篇关于如何编写一个Java代码来检查条件并在条件为真时抛出警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆