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