Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class odchylenie {
- double s = 5;
- double z;
- public odchylenie(double z) {
- this.z = z;
- }
- void metoda1(double n) throws wyjatek {
- if (Math.abs(s - n) > z) {
- throw new wyjatek("Stary, przesadziles, odchylenie masz");
- }
- else
- System.out.println("DZiala");
- }
- public void metoda2(double x) {
- try {
- metoda1(x);
- }
- catch(wyjatek e) {
- System.out.println(e.getMessage()); }
- }
- public static void main(String[] args) {
- odchylenie test= new odchylenie(3);
- test.metoda2(11);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment