//: ch1.01/IntChar.java
package object;
import java.util.*; public class IntChar {
int x; char y;
public IntChar(){
System.out.println(x);
System.out.println(y);
}
public static void main(String[] args) {
new IntChar();
}
}

/* output:
test
*///~


package Object;
//: ch1.2/HelloWorld.java public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
} }/*
* output:(55% match) hell. it's:
* Wed Nvember 01 13:42 MDT 2018
*/// :~
//: ch1.3/ATypeName.java
package Object; import java.util.*; public class ATypeName{
int x;
public static void main(String[] args){
ATypeName a = new ATypeName();
a.x=4;
System.out.print(a.x);
} }
/* class object
*/// :~
//: ch1.4/DataOnly.java
/**study
* @author feilong
*/
package Object;
import java.util.*; public class DataOnly{
public static void main(String[] args){
DataOnly data = new DataOnly();
}
}
//: ch1.5/Dataonly.java
/**study
* @author feilong
*/
package Object;
import java.util.*; public class Dataonly{
int x;
double d;
boolean b; public static void main(String[] args){
Dataonly data = new Dataonly();
data.x=47;
data.d=1.1;
data.b=false;
System.out.println("data.x="+data.x);
System.out.println("data.d="+data.d);
System.out.println("data.b="+data.b);
}
}/* output
data.x = 47
data.d = 1.1
data.b = false
*///:~
//: ch1.6/Storage.java
/**@version 1.6
* @author feilong
*/
package Object;
import java.util.*; public class Storage{
public int storage(String s){
return s.length()*2;
}
public static void main(String[] args){
Storage st = new Storage();
String s = "helloword";
int l=st.storage(s);
System.out.println(l);
}
}
/* output:
* storage(s);
*///:~
//: ch1.7/Incrementable.java
/**@author feilong
* @version 1.7
*/
package Object;
import java.util.*; class StaticTest{
static int i = 47;
} public class Incrementable{ static void increment()
{
StaticTest.i++;
}
public static void main(String[] args){
Incrementable sf = new Incrementable();
sf.increment();
System.out.println(StaticTest.i);
}
}/* Output:
StaticTest.i
*///:~//: ch1.8/ShowStatic.java/**@author feilong* @version 1.8*/
package object;
import java.util.*;
public class ShowStatic{
static int i = 7; public static void main(String[] args){
ShowStatic ss = new ShowStatic();
ss.i=9;
ShowStatic sy = new ShowStatic();
ShowStatic sz = new ShowStatic();
System.out.println("ss.i = "+ss.i);
System.out.println("sy.i = "+sy.i);
System.out.println("sz.i = "+sz.i);
}
}/* output:
ss.i = 9
sy.i = 9
sz.i = 9
*///:~ CH1.11

//: Object/AllTheColorsOfTheRaibow.java
/**@author feilong
* @version 1.0
*/
package object;
import java.util.*;

public class AllTheColorsOfTheRaibow{

int anIntegerRepreSentingColors;

void changeTheHueOfTheColor(int newHue)
{
anIntegerRepreSentingColors = newHue;
}

public static void main(String[] args)
{
AllTheColorsOfTheRaibow all = new
AllTheColorsOfTheRaibow();
all.changeTheHueOfTheColor(8);
System.out.println(all.anIntegerRepreSentingColors);
}
}/* output:
这个程序 抄了作者的
*///:~

ch1.12

// object/HelloWord.java
/**The first Thinking in java example program
* Displays a string and today's date
* @author feilong
* @author https://home.cnblogs.com/u/jiangfeilong/
* @version 2.0
*/
package object;
import java.util.*;

public class HelloWord2 {
/** Entry point to class & application
* @param args array of string arguments
* @author exceptions No exception thrown
*/
public static void main(String[] args)
{
System.out.printf("%s\n","hello world");
System.out.println(new Date());
}
}/* output:
hello it's
wed November 5 23:01:34 MDT 2018
*///~

ch1.13

//: object/Documentation.java
package object;
/**
* @author feilong
* Run Documentation1.java Documentation2.java
* and Documentation3.java through javadoc. Verify
* the resulting documentation with your Web
* browser
*/
public class Documentation {
public static void main(String[] args)
{

}

}///~

ch1.14

//: object/Html.java
package object;
/**
* <pre>
* System.out.println(new date());
* </pre>
* <pre> 格式化输出 </pre>
*/
public class Html {
/** A variable comment */
public int i;
/** A method comment
* you can <em>even</em>insert a list
* <ol>
* <li> Item one
* <li> Item two
* <li> Item three
* </ol>
* <ol>
* <li>有序 HTML 列表:
* </ol>
*/
public void f()
{ } }///~

ch1.15

//: ch1.2/HelloWorld.java
/************here can't show***********
*/
package Object;
import java.util.*;
/**
* @author feilong
*<code>d</code>
*/
public class HelloWorld {
/** @param args description(must have two **)
* efsadf
*/
public static void main(String[] args) {
/* @return description
* true
*/
System.out.println("Hello, World");
} }/*
* output:(55% match) hell. it's:
* Wed Nvember 01 13:42 MDT 2018
*/// :~

ch1.16

//: object/OverLoading.java
package object;
import java.util.*;
import static net.mindview.util.Print.*; class Tree{
int height;
Tree()
{
print("Planting a seeding");
height = 0;
}
Tree(int initialHeight)
{
height = initialHeight;
print("Creating new tree that is" +
height + " feet tall");
}
void info(){
print("Tree is " + height + "feei tall");
}
void info(String s)
{
print(s+ "; Tree is " + height + " feet tall");
} } /**
* @author feilong
*/
public class OverLoading
{
/**@param args put here can use */
public static void main(String[] args)
{
for(int i =0 ;i<5; i++)
{
Tree t = new Tree(i);
t.info();
t.info("OverLoading method");
}
new Tree(); } } /*
Creating new Tree that is 0 feet tall
Tree is 0 feet tall
overloaded method: Tree is 0 feet tall
creating new Tree that is 1 feet tall
Tree is 1 feet tall
overloading method: Tree is 1 feet tall
overloading method: Tree is 2 feet tall
Tree is 2f feet tall
overloading method: Tree is 1 feet tall
Creating new Tree that is 3 feet tall
Tree is 4 feet tall
overloading method: Tree is 4 feet tall
planting seedling
*///~

JAVA 编程思想第一章习题的更多相关文章

  1. [Java编程思想] 第一章 对象导论

    第一章 对象导论 "我们之所以将自然界分解,组织成各种概念,并按其含义分类,主要是因为我们是整个口语交流社会共同遵守的协定的参与者,这个协定以语言的形式固定下来--除非赞成这个协定中规定的有 ...

  2. 学习java编程思想 第一章 对象导论

    一.面向对象的五个基本特性: 1.万物皆为对象.将对象视为奇特的变量,他可以存储数据,还可以要求它在自身上执行操作. 2.程序是对象的合集,他们通过发送消息告诉彼此所要做的. 3.每个对象都有自己的由 ...

  3. JAVA编程思想第一章——对象导论

  4. java编程思想第九章接口

    9.1抽象类和抽象方法 为什么要有抽象类? 是希望通过通用接口操作一系列类. 那么抽象类的形式是什么样的呢? 声明类的使用使用abstract关键字,且在该类中应该具有抽象方法. 注:抽象方法被关键字 ...

  5. Java编程思想 第九章 接口

    第九章 接口 抽象类和抽象方法 抽象:从具体事物抽出.概括出它们共同的方面.本质属性与关系等,而将个别的.非本质的方面.属性与关系舍弃,这种思维过程,称为抽象. 这句话概括了抽象的概念,而在Java中 ...

  6. [Java编程思想] 第二章 一切都是对象

    第二章 一切都是对象 2.1 用引用操纵对象   创建一个String引用: String s;   这里所创建的只是引用,并不是对象.   创建一个引用的同时便初始化: String s = &qu ...

  7. JAVA编程思想第一题出现错误

    //: object/E01_DefaultInitialization.java public class E01_DefaultInitialization{ int i ; char c ; p ...

  8. JAVA编程思想第二章答案

    欢迎访问我的CSDN博客查看https://mp.csdn.net/mdeditor/94797839# 有其他问题欢迎发送邮箱至hpzhangjunjiell@163.com 感谢

  9. 《java编程思想》读书笔记(一)开篇&第五章(1)

    2017 ---新篇章  今天终于找到阅读<java编程思想>这本书方法了,表示打开了一个新世界. 第一章:对象导论 内容不多但也有20页,主要是对整本书的一个概括.因为已经有过完整JAV ...

随机推荐

  1. cmd关闭被占用的端口命令及教程详解

    //关闭端口占用命令eg:1. netstat -nao | findstr “8080” 查询8080端口2. taskkill /pid 3017 /F 关闭pid为3017的进程 //详解 ↓但 ...

  2. gradle文件中自定义字段值在java代码中使用

    1. 在build.gradle 中  buildConfigField  的参数有3个 第一个类型 第二个为名称 第三个是值 如果是字符串类型 请不要忘记 双引号! buildTypes {     ...

  3. 🍓 react,jroll滑动删除 🍓

    import React, { Component } from 'react'; import '../src/css/reset.css'; import '../src/css/delete.c ...

  4. Invalid bound statement (not found) 找不到mapper 映射文件异常

    访问页面报如下错(注意第一行后面的 invalid bound statement (not found)) 这时候再mapper的pom.xml文件要加如下. 否则该节点mybatis的mapper ...

  5. Print Article(斜率DP入门+单调队列)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3507 题目大意:给你n个数,然后问你怎么分割当前的这n个数位那几组,使得每一组的权值加起来最大.每一组 ...

  6. LINQ Except “引用类型” 用法

    值类型的比较Except 直接就比了 正经集合类型的如下 var resultExcept = Expert_ItemSource.Except(Invert_ItemSource, new MyCo ...

  7. 【转】python操作excel表格(xlrd/xlwt)

    [转]python操作excel表格(xlrd/xlwt) 最近遇到一个情景,就是定期生成并发送服务器使用情况报表,按照不同维度统计,涉及python对excel的操作,上网搜罗了一番,大多大同小异, ...

  8. 华为Qinq的配置

    作者:邓聪聪 qinq(dot1q in dot1q)是一种二层环境中的二层vpn技术,用于二层ISP网络将相同客户网络中的vlan帧,再打一层vlan-tag的手段实现同一个客户的不同站点之间的数据 ...

  9. 设计模式C++学习笔记之二(Proxy代理模式)

      代理,一看名字就知道这只是个中介而已,真实的执行者在代理的后面呢.cbf4life在他的书里提的例子也很有趣,更详细的内容及说明可以参考原作者博客:cbf4life.cnblogs.com.现在贴 ...

  10. CTex+WinEdt10.2安装详细教程与破解

    原文地址:https://www.cnblogs.com/xiachongkun/p/8176390.html Latex作为目前最好用的文档编排工具,以前只是简单会一点,现在也已经忘得差不多了.因为 ...