Advertisement
Guest User

Untitled

a guest
Feb 12th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1. package pl.wsis.java;
  2.  
  3. public class Zad1 {
  4.     // Napisz metodę, która jako parametr będzie przyjmowała napis i wypisywałą na standardowe wyjście jego długość
  5.     public void wypiszDlugosc(String tekst) {
  6.         System.out.println("Długość tekstu to: " + tekst.length());
  7.     }
  8.  
  9.  
  10.     // 5.
  11.     public static void main(String[] args) throws Exception {
  12.         Zad1 zad1 = new Zad1();
  13.         try {
  14.             zad1.wypiszDlugosc(null);
  15.         } catch (Exception ex) {
  16.             ex.printStackTrace();
  17.             throw new Exception();
  18.         }
  19.     }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement