2016-02-25 35 views
-1

我是Java新手,我有一个代码,其中有一个包。我的问题是我试图运行Jgrasp上的代码,这是我的学校程序来运行代码。 Jgrasp不使用包。因为包裹,我无法运行它。我不知道软件包是如何工作的,但我为此写了一整个代码并将它交给了一位朋友,他编辑了我的代码并将其编译成一个包,并说它可以工作。我不想要这个软件包,我想要他写下的完整代码,而不是下面的主要方法。如何在Java中打开和查看包中的代码

package insta2; 
import java.io.*; 
import java.util.*; 
class BottomUpApp { 
    public static void main(String[] args) throws IOException { 
     BottomUp bup; 
     Tree theTree = null; 
     int value; 
     String str; 

     while (true) { 
     System.out.print(" Enter first letter of balanced"); 
     System.out.print(" unbalanced , show , or traverse : "); 
     int choice = getChar(); 
     switch (choice) { 
     case 'b': 
     System.out.print(" Enter string : "); 
     str = getString(); 
     bup = new BottomUp(str); 
     bup.balanced(); 
     theTree = bup.getTree(); 
     break; 

        case 'u': 
        System.out.print("Enter string: "); 
        str = getString(); 
        bup = new BottomUp(str); 
        bup.unbalanced(); 
        theTree = bup.getTree(); 
        break; 


     case 's': 
     theTree.displayTree(); 
     break; 
     case 't': 
     System.out.print(" Enter type 1, 2 or 3 : "); 
     value = getInt(); 
     theTree.traverse(value); 
     break; 
     default: 
     System.out.print(" Invalid entry \n "); 
     } 
     } 
    } 
    public static String getString() throws IOException { 
     InputStreamReader isr = new InputStreamReader(System.in); 
     BufferedReader br = new BufferedReader(isr); 
     String s = br.readLine(); 
     return s; 
    } 
    public static char getChar() throws IOException { 
     String s = getString(); 
     return s.charAt(0); 
    } 

    public static int getInt() throws IOException { 
     String s = getString(); 
     return Integer.parseInt(s); 
    } 
} 
+0

对不起,这个问题没有意义。我在您发布的代码中看到您的软件包和两个来自Java的软件包。你想看什么,为什么? – duffymo

+0

我想看到包insta2代码。我猜这个软件包有一个书面的代码吗? – CSStudent

+0

这就是为什么你让我困惑。 “package insta2”位于您发布代码的顶部。您发布的课程位于该包中。你有代码。你是在暗示还有更多?你写了这个还是做了其他人?如果是后者,请做与发布问题相同的事情。我会再问一次:你真正的问题是什么?如果你只有一个带有编译字节码的JAR,你总是可以用IntelliJ这样的智能IDE来查看反编译后的源代码。你真正的问题是什么? – duffymo

回答

0

jGRASP没有软件包的问题。

我猜你的代码不在名为“insta2”的目录中。

相关问题