Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GenerickeMetody {
- public static void main(String[] args) {
- Integer[] poleObjCisla = {4, 8, 2, 3};
- Character[] poleObjZnaky = {'a', 'x', 'c'};
- String[] poleStringov = {"Karol","Eva","Nina"};
- vytlacPole(poleObjCisla);
- vytlacPole(poleObjZnaky);
- vytlacPole(poleStringov);
- }
- public static <T> void vytlacPole(T[] pole){
- for (T t : pole) {
- System.out.print(t);
- }
- System.out.println("");
- }
- // private static void vytlacPole(Integer[] poleObjCisla) {
- // for (Integer i : poleObjCisla) {
- // System.out.print(i);
- // }
- // System.out.println("");
- // }
- //
- // private static void vytlacPole(Character[] poleObjZnaky) {
- // for (Character x : poleObjZnaky) {
- // System.out.print(x);
- // }
- // System.out.println("");
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment