summaryrefslogtreecommitdiff
path: root/base/ex46.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-26 15:50:38 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-26 15:50:38 -0600
commit1851f5e76018ec1df3b55dce6cc9a64c9497bf7a (patch)
tree30f629f7b137a494d4202487f4e22df2d9456481 /base/ex46.java
parent012298517078170762112abe2654dc69b2f146e1 (diff)
Rearrange directory structure
Diffstat (limited to 'base/ex46.java')
-rw-r--r--base/ex46.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/base/ex46.java b/base/ex46.java
new file mode 100644
index 0000000..55724d6
--- /dev/null
+++ b/base/ex46.java
@@ -0,0 +1,32 @@
+class ex46 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo()) ;
+ System.out.println(a.foo()) ;
+ result = a.bar(10, 20);
+ System.out.println(result) ;
+ }
+}
+
+class A {
+
+ int c ;
+ int d ;
+
+ public int foo() {
+ d = 0 ;
+ c = 1 + 2 ;
+ d = c + d ;
+ return d ;
+ }
+
+ public int bar(int a, int b) {
+ int result ;
+ c = a ;
+ d = b ;
+ result = c * d ;
+ return result ;
+ }
+}