Java programming ideology Chapter 6 Personal exercises and java programming ideology

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.