@nabbit123/

Project 11C

Java

No description

fork
loading
Files
  • Main.java
  • Main.class
  • Main$Num.class
  • Main$ParameterTester.class

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.5374986417723742","path":"Main.java","file":{"path":"Main.java","content":{"asEncoding":{"base64":"Y2xhc3MgTWFpbnsKICAgLy8tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAvLyAgU2V0cyB1cCB0aHJlZSB2YXJpYWJsZXMgKG9uZSBwcmltaXRpdmUgYW5kIHR3byBvYmplY3RzKSB0bwogICAvLyAgc2VydmUgYXMgYWN0dWFsIHBhcmFtZXRlcnMgdG8gdGhlIGNoYW5nZVZhbHVlcyBtZXRob2QuIFByaW50cwogICAvLyAgdGhlaXIgdmFsdWVzIGJlZm9yZSBhbmQgYWZ0ZXIgY2FsbGluZyB0aGUgbWV0aG9kLgogICAvLy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tCiAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKXsKICAgICAgUGFyYW1ldGVyVGVzdGVyIHRlc3RlciA9IG5ldyBQYXJhbWV0ZXJUZXN0ZXIoKTsKICAgICAgaW50IGExID0gMTExOwogICAgICBOdW0gYTIgPSBuZXcgTnVtICgyMjIpOwogICAgICBOdW0gYTMgPSBuZXcgTnVtICgzMzMpOwogICAgICBTeXN0ZW0ub3V0LnByaW50bG4gKCJCZWZvcmUgY2FsbGluZyBjaGFuZ2VWYWx1ZXM6Iik7CiAgICAgIFN5c3RlbS5vdXQucHJpbnRsbiAoImExXHRhMlx0YTMiKTsKICAgICAgU3lzdGVtLm91dC5wcmludGxuIChhMSArICJcdCIgKyBhMiArICJcdCIgKyBhMyArICJcbiIpOwogICAgICB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AgU3lzdGVtLm91dC5wcmludGxuICgiQmVmb3JlIGNoYW5naW5nIHRoZSB2YWx1ZXM6Iik7CiAgICAgIFN5c3RlbS5vdXQucHJpbnRsbiAoImYxXHRmMlx0ZjMiKTsKICAgICAgU3lzdGVtLm91dC5wcmludGxuIChmMSArICJcdCIgKyBmMiArICJcdCIgKyBmMyArICJcbiIpOwogICAgICBmMSA9IDk5OTsKICAgICAgZjIuc2V0VmFsdWUgKDg4OCk7CiAgICAgIGYzID0gbmV3IE51bSAoNzc3KTsKICAgICAgU3lzdGVtLm91dC5wcmludGxuICgiQWZ0ZXIgY2hhbmdpbmcgdGhlIHZhbHVlczoiKTsKICAgICAgU3lzdGVtLm91dC5wcmludGxuICgiZjFcdGYyXHRmMyIpOwogICAgICBTeXN0ZW0ub3V0LnByaW50bG4gKGYxICsgIlx0IiArIGYyICsgIlx0IiArIGYzICsgIlxuIik7CiAgICB9CiAgfQp9Cg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
class Main{
   //-----------------------------------------------------------------
   //  Sets up three variables (one primitive and two objects) to
   //  serve as actual parameters to the changeValues method. Prints
   //  their values before and after calling the method.
   //-----------------------------------------------------------------
   public static void main (String[] args){
      ParameterTester tester = new ParameterTester();
      int a1 = 111;
      Num a2 = new Num (222);
      Num a3 = new Num (333);
      System.out.println ("Before calling changeValues:");
      System.out.println ("a1\ta2\ta3");
      System.out.println (a1 + "\t" + a2 + "\t" + a3 + "\n");
      tester.changeValues (a1, a2, a3);
      System.out.println ("After calling changeValues:");
      System.out.println ("a1\ta2\ta3");
      System.out.println (a1 + "\t" + a2 + "\t" + a3 + "\n");
   }
   public static class Num{
   private int value;
   //-----------------------------------------------------------------
   //  Sets up the new Num object, storing an initial value.
   //-----------------------------------------------------------------
   public Num (int update){
      value = update;
   }
   //-----------------------------------------------------------------
   //  Returns the stored integer value.
   //-----------------------------------------------------------------
   public int getValue (){
      return value;
   }
   //-----------------------------------------------------------------
   //  Sets the stored value to the newly specified value.
   //-----------------------------------------------------------------
   public void setValue (int update){
      value = update;
   }
   //-----------------------------------------------------------------
   //  Returns the stored integer value as a string.
   //-----------------------------------------------------------------
   public String toString (){
      return value + "";
   }
}
public static class ParameterTester{
   //-----------------------------------------------------------------
   //  Modifies the parameters, printing their values before and
   //  after making the changes.
   //-----------------------------------------------------------------
   public void changeValues (int f1, Num f2, Num f3){
      System.out.println ("Before changing the values:");
      System.out.println ("f1\tf2\tf3");
      System.out.println (f1 + "\t" + f2 + "\t" + f3 + "\n");
      f1 = 999;
      f2.setValue (888);
      f3 = new Num (777);
      System.out.println ("After changing the values:");
      System.out.println ("f1\tf2\tf3");
      System.out.println (f1 + "\t" + f2 + "\t" + f3 + "\n");
    }
  }
}