Java programming ideology Chapter 6 Personal exercises and java programming ideology
Exercise 1: (1) create a class in a package and create an instance of the class outside the package of the class.
Import mil. oms. main. test. test; public class MainTest {public static void main (String args []) {Test test = new Test ();}/** Test () instantiation of the running result ...... */}
Package mil. oms. main. test; public class Test {public Test () {System. out. println ("Test () instantiate ...... ");}}
Exercise 2: (1) rewrite the code snippets in this Section into a complete program and verify the actual conflicts.
import mil.oms.main.test.Vector;import java.util.*;public class MainTest { public static void main(String args[]){ Vector vector=new Vector(); java.util.Vector vector1=new java.util.Vector(); }}
Package mil. oms. main. test; public class Vector {public Vector () {System. out. println ("Vector () instantiation ...... ");}}
Exercise 3: (1) create two packages: debug and debugoff. They all contain the same class. This class has a debug () method. The first version shows the String parameter sent to the console, the second version does nothing. It imports the class into a test program using a static import Statement and demonstrates the condition compilation effect.
Import debug. test; public class MainTest {public static void main (String args []) {Test t = new Test (); t. debug ();}/*** running result Test ()...... */}
package debug;public class Test{public void debug(){System.out.println("Test()……");}}
package debugoff;public class Test{public void debug(){}}
Who has the answer to the fourth edition of java programming ideas?
No one answered the question. Join the QQ group about JAVA or join the group about this book directly. They have answers. I am also a fan. I suggest using this!
Answers to exercises in JAVA programming ideology (version 4)
Download.csdn.net/source/42620
This is on CSDN. You must register a user before downloading it.
CSDN is a gathering place for national programmers. It will be helpful to you if you have nothing to do.