//: 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. NPOI2.2.0.0实例详解(九)—设置EXCEL单元格【时间格式】

    原文:http://blog.csdn.net/xxs77ch/article/details/50245391 using System; using System.Collections.Gene ...

  2. wx小程序-音频视频!

    1.音乐的启动跟暂停 dom里面图片切换的另一种方法 通过变量 改变路径 2.监听 在onload里面 3.定义了一个全局变量 然后在但页面中获取 app.js 单页面中 app.js 的三个生命周期

  3. C++以const 作为返回值类型的意义

    const rational operator*(const rational& lhs, const rational& rhs); 很多程序员第一眼看到它会纳闷:为什么operat ...

  4. IPC$横向渗透代码实现

    思路 IPC$横向渗透的方法,也是病毒常用的扩散方法. 1.建立连接 2.复制文件到共享中C$.D$.E$.F$ 3.获取服务器的时间 3.设定计划任务按时间执行 用到的Windows API 建立网 ...

  5. 【leetcode】893. Groups of Special-Equivalent Strings

    Algorithm [leetcode]893. Groups of Special-Equivalent Strings https://leetcode.com/problems/groups-o ...

  6. 深入理解 sudo 与 su 之间的区别【转】

    深入理解 sudo 与 su 之间的区别 两个命令的最大区别是: sudo 命令需要输入当前用户的密码,su 命令需要输入 root 用户的密码.另外一个区别是其默认行为.sudo 命令只允许使用提升 ...

  7. 后台拼接json字符串,传到前台时注意特殊符号处理

    1.后台拼接常用的形式:     sb.AppendFormat("\"字段名\":\"{0}\"", i + 1); 这个要注意字符串截断 ...

  8. 【转】Linux下gcc生成和使用静态库和动态库详解

    一.基本概念 1.1 什么是库 在Windows平台和Linux平台下都大量存在着库. 本质上来说,库是一种可执行代码的二进制形式,可以被操作系统载入内存执行. 由于windows和linux的平台不 ...

  9. $Django 在线文本编辑器skindeditor

    简介 KindEditor是一套开源的在线HTML编辑器,主要用于让用户在网站上获得所见即所得编辑效果,开发人员可以用 KindEditor 把传统的多行文本输入框(textarea)替换为可视化的富 ...

  10. Spring动态数据源实现读写分离

    一.创建基于ThreadLocal的动态数据源容器,保证数据源的线程安全性 package com.bounter.mybatis.extension; /** * 基于ThreadLocal实现的动 ...