1 // jprint.java test program. 2 // 3 // Copyright 2004 4 // Free Software Foundation, Inc. 5 // 6 // Written by Jeff Johnston <jjohnstn@redhat.com> 7 // Contributed by Red Hat 8 // 9 // This file is part of GDB. 10 // 11 // This program is free software; you can redistribute it and/or modify 12 // it under the terms of the GNU General Public License as published by 13 // the Free Software Foundation; either version 2 of the License, or 14 // (at your option) any later version. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program; if not, write to the Free Software 23 // Foundation, Inc., 59 Temple Place - Suite 330, 24 // Boston, MA 02111-1307, USA. 25 26 class jvclass { 27 public static int k; 28 static { 29 k = 77; 30 } addprint(int x, int y, int z)31 public static void addprint (int x, int y, int z) { 32 int sum = x + y + z; 33 System.out.println ("sum is " + sum); 34 } 35 addk(int x)36 public int addk (int x) { 37 int sum = x + k; 38 System.out.println ("adding k gives " + sum); 39 return sum; 40 } 41 } 42 43 public class jprint extends jvclass { dothat(int x)44 public int dothat (int x) { 45 int y = x + 3; 46 System.out.println ("new value is " + y); 47 return y + 4; 48 } print(int x)49 public static void print (int x) { 50 System.out.println("x is " + x); 51 } print(int x, int y)52 public static void print (int x, int y) { 53 System.out.println("y is " + y); 54 } main(String[] args)55 public static void main(String[] args) { 56 jprint x = new jprint (); 57 x.print (44); 58 print (k, 33); 59 } 60 } 61 62 63