]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.java/jprint.java
gdb/
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.java / jprint.java
CommitLineData
7213f6d6
JJ
1// jprint.java test program.
2//
6f451e5e 3// Copyright 2004, 2010
7213f6d6
JJ
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
d53a7b30 13// the Free Software Foundation; either version 3 of the License, or
7213f6d6 14// (at your option) any later version.
d53a7b30 15//
7213f6d6
JJ
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.
d53a7b30 20//
7213f6d6 21// You should have received a copy of the GNU General Public License
d53a7b30 22// along with this program. If not, see <http://www.gnu.org/licenses/>.
7213f6d6 23
6f451e5e
TT
24import java.util.Properties;
25
7213f6d6
JJ
26class jvclass {
27 public static int k;
28 static {
29 k = 77;
30 }
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
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
43public class jprint extends jvclass {
6f451e5e
TT
44 public static Properties props = new Properties ();
45
7213f6d6
JJ
46 public int dothat (int x) {
47 int y = x + 3;
48 System.out.println ("new value is " + y);
49 return y + 4;
50 }
51 public static void print (int x) {
52 System.out.println("x is " + x);
53 }
54 public static void print (int x, int y) {
55 System.out.println("y is " + y);
56 }
57 public static void main(String[] args) {
58 jprint x = new jprint ();
dc5000e7 59 x.dothat (44);
7213f6d6
JJ
60 print (k, 33);
61 }
62}
63
64