Java programming ideology (version 4) * Chapter 2 personal exercises and java programming ideology

Source: Internet
Author: User

Java programming ideology (version 4) * Chapter 2 personal exercises and java programming ideology
Create a class that contains an int field and a char field. They are not initialized and printed out to verify that java performs the default initialization.


Public class DomTest {int I; char c; public DomTest () {System. out. println ("I =" + I + "\ nc = [" + c + "]" + "\ n []"); /*** print the following result: I = 0 c = [] [] // For comparison only. */}/*** @ param args */public static void main (String [] args) {new DomTest ();}}

Create a Hello, world program. This program only needs to output this sentence.

Public class DomTest {/*** @ param args */public static void main (String [] args) {System. out. println ("Hello, Word");}/*** running result Hello Word */}

Find the code segment containing ATypeName, rewrite it into a complete program, compile and run it.

Public class ATypeName {public static void main (String [] args) {System. out. println ("Hello Word") ;}/ *** running result Hello Word */}




Java programming ideas fourth edition Chapter 2 exercise questions

Exercise 2
//: C02: E02_ATypeName.java
// + M java E02_ATypeName
/***************** Exercise 2 ******************
* Find the code fragments involving ATypeName
* And turn them into a program that compiles and
* Runs.
**************************************** *******/
Public class E02_ATypeName {
Public static void main (String args []) {
E02_ATypeName a = new E02_ATypeName ();
}
}///:~
 
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!

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.