LOADING...

加载过慢请开启缓存(浏览器默认开启)

loading

P-luminary

连续、导数、隐函数、高阶导数

2022/6/25

连续

  • 设函数y=f(x)在点x0处连续,则y=f(x)在x0处的极限存在。

  • 如果x0是函数f(x)的间断点,且左极限右极限都存在,则称x0为函数f(x)的第一类间断点

  • 第一类间断点[可去间断点 + 跳跃间断点]

  • 左右极限都存在且相等时,属于第一类间断点,且为可去间断点

  • 左右极限都存在但不相等时,属于第一类间断点,且为跳跃间断点

  • 左右极限至少有一个不存在时,属于第二类间断点

  • 求初等函数的间断点即求不在函数定义域内的点,而使两个分母分别为0的点不在定义域内

  • 初等函数在其定义区间每点处都是连续的,所以找初等函数的间断点,只需要找出其无定义的点即可

连续函数性质的应用

证明连续的题:

1、先说明函数___在[ , ]上连续,因为…

2、f(?) > 0,f(?) < 0 根据零点定理**可知函数式在[ , ]内至少有… (如果函数y= f(x)在区间[a,b]上的图象是连续不断的一条曲线,并且有f(a)·f(b)<0**,那么,函数y= f(x)在区间(a,b)内有零点,即至少存在一个c∈(a,b),使得f(c)=0,这个c也就是方程f(x)= 0的根)

3、至少的正根可以根据函数f() > 0, f() < 0来判定,至多的正根可以根据函数的导数大于0判断单调递增来说明。

连续性+导数(可导性)

  • 法线:k * k法 = -1
  • 两条直线若都存在斜率且平行,则两条直线的斜率相等
  • sin2x = 2sinxcosx (sin2x)’ = 2cos2x
  • cos2x = $2cosx^2$ - 1 = 1 - $2sinx^2$ (cos2x)’ = -2sin2x
  • tan2x = $sec^2x$ - 1 (tan2x)’ = 2sec^2x

导数的定义

导数的定义技巧1

导数的定义技巧2

导数的定义技巧3

连续性+导数大题

  • 大题部分:解决该类问题的基本思路根据分段函数在其分界点处的性质来确定所含常数的值,若一函数在其分界点可导,首先在该点**连续;而在分界点的导数则按导数定义或左右导数**的定义来导
  • ①先根据f(?) 带入两个式子 若 f1(?) = f2(?) 则证明该分段函数在x=?处是否连续;②之后根据f’-(?) 与 f’+(?)是否相等来判断该分段函数是否可导
  • 函数y = f(x) 在点x0处左可导、右可导,并且左右导数相等,y = f(x)在点x0处才可导;函数y = f(x)在点x0处可导,必在此点连续;函数y=f(x) 在点x0处连续,未必在此点可导


导数+隐函数

$x^x$=$e^xlnx$

对于函数y=u(x)$^v$$^x$,其中u(x) > 0求导,可采用公式变形法,变形成复合指数函数,y=e^[v(x)lnu(x)]

y=f(x+1),y’=f’(x+1) + (x+1)’

  • 可导的奇函数的导数为偶函数,可导的偶函数的导数为奇函数
  • 隐函数求导方法:求y对x的导数时要用符合函数的求导法则,然后将含有y’的项放到等式的一端,不含y’的项移到另一端,求y‘。【只要见到隐函数里的y’就把它再求导一遍 (+2xy)’ = 2y+2xy’、 (y^2) = 2y’y
  • 对数函数f(x)=u(x)^v(x) 求导可用**对数求导法 **[两边取自然对数]
  • 指数函数y=e^v(x)lnu(x) 公式变形法[变形成复合]
  • 欲求由方程F(x,y)=0所确定的隐函数y=f(x)的导数,要把方程中的x看作自变量,而将y视为x的函数,方程中关于y的函数便是x的复合函数,用复合函数的求导方法,即可得到关于y’的一次方程,从中解得y’即为所求

高阶导数

  • 高阶导数的方法有不完全归纳法,即求出所给函数的1-3阶或4阶导数后,分析所得结果的规律,写出n阶导数↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

  • (x^3^)^(5)^表示x^3^的五阶导数,根据幂函数求导公式易得:第三阶导数为常数,因此第四阶和第五阶导数必为0

f(x) = x^n^ 的n+1阶导数为0 => f(x) = (x^n^)^(n+1)^ = 0

  • (d^2^y)/(dx^2^) 高级模板↓

高级二次求导含复合变量

阅读全文

刘晓艳翻译

2022/5/10

文章长度

四级:140-160 words

六级:200 words

各档次的评分标准:

13-15分 译文准确表达了原文的意思。用词贴切,行文流畅,基本上无语言错误,仅有个别小错。

10-12分 译文基本上表达了原文的意思。文字通顺、连贯,无重大语言错误。

翻译单词不会写怎么办(谁都可以写成被动)

人或人称代词做主语都可以考虑成被动

① 用该单词的上位词来代替该单词(守门员 -> 运动员 -> 男人)(榴莲 -> 食物 -> 东西)(指南针 -> 设备 -> 工具)

用会的单词把这个意思解释出来(春联能增加节日氛围 -> 春联能使人们开心)

同义词近义词改写

④ 大词就吓胡写,小词就装作没看见

  • 主谓宾上的是大词,剩下的都是小词(我爱上了美丽的大雁)
    • 大词:我 爱 大雁
    • 小词:美丽的
铁观音一年四季均可采摘,尤其是春秋两季采摘的茶叶品质最佳(先找主谓[定语态 定时态])
Tieguanyin can be picked all the year around with the best
in Spring and Autumn.
Tieguanyin can be picked anytime in a year in Spring and Autumn.
普洱茶深受中国人喜爱
Pu'er Tea is deeply loved by Chinese people. 
很多人认为合作比个人能力更重要
Cooperation is claimed to be more crucial than personal ability.
认为:claimed assume argue
重要关键的:crucial essential critical
人们普遍认为网购已经成为一种流行趋势
Online shopping is aruged to be a popular trend among the young and
the old.
那时,黄色是专为皇帝使用的颜色,皇家宫殿全都漆成黄色,黄袍总是黄色的,而普通老百姓是禁止穿黄色衣服的
At that time, yellow was designed to use for the emperons the roral
palace was painted yellow and the clothes of king was always yellow too,
However, the ordinary people were not allowed to wear yellow clothes.

步骤

  • 以意群为单位读句子,确定句子的时态语态
  • 确定句子的主干,非主干部分通过**定语(修饰名词)状语(除定语外)**方式来翻译
  • 每一句话翻译完,看这句活与下句话之间的逻辑关系,加逻辑关系词

例1:

龙井是一种绿茶,主要产自中国东部沿海的浙江省// 龙井茶独特的香味和口感为其赢得了“中国名茶”的称号,在中国深受大众的欢迎,在海外饮用的人也越来越多// 龙井茶通常手工制作,其价格可能及其昂贵,也可能比较便宜,这取决于茶的生长地,采摘时间和制作工艺。**//** 龙井茶富含维生素C和其他多种有益健康的元素。经常喝龙井茶有助于减轻疲劳、延缓衰老

龙井是一种绿茶(主系表),(这种绿茶->which)主要产自中国东部沿海的浙江省
Longjing is a type of green tea which is mainly produceed in Zhejiang 
Province in the east of China.
龙井茶(因为)独特的香味和口感(状语)为其赢得了“中国名茶”的称号,(主语)在中国深受大众的欢迎
,在海外饮用的人也越来越多。(主谓宾->龙井茶赢得了称号) 
With its unique taste, the tea gets a name of China's Famous Tea which is
popular at home and also overseas.
龙井茶(主)通常(副词做状语)手工(状语by hand)制作(谓)
In fact, Longjing is usually made by hand.
其价格可能及其昂贵,也可能比较便宜,这(which)取决于茶的生长地,采摘时间和制作工艺
It can be extremely expensive or comparatively cheap, which depends on its
origin, picking time and its craft.
龙井茶(主)富含(谓)维生素C和其他多种有益健康的元素(宾)。
经常喝龙井茶有助于减轻疲劳(使你快乐)、延缓衰老(使你年轻漂亮)
Besides, it contains rich Vitamin C and many other beneficial elements.
As a result, the tea helps relieve fatigue and delay the aging process
if one drinks it regularly.

例2:

大运河是世界上最长的人工河,北起北京,南至杭州。// 它是中国历史上最宏伟的工程之一。// 大运河始建于公元前4世纪,公园13世纪末建成。// 修建之初是为了运输粮食,后来也用于运输其他商品。// 大运河沿线区域逐渐发展成为中国的工商业中心。// 长久以来,大运河对中国经济发展发挥了重要作用,有力地促进了南北地区之间的人员往来和文化交流。

大运河(主)是(谓)世界上最长的(定语)人工河(宾),北起北京,南至杭州。
The Grand Canal is one of the longest river in the world, which is from
Beijing to Hangzhou
它(主)是(系)中国历史上最宏伟的(定)工程之一(表)。
大运河(which)始建于公元前4世纪,公园13世纪末建成。
It is one of the greatest projects in the Chinese history which began
in the 4th century and was completed at the end of 13th century.
修建之初(他的目的)是为了运输粮食,后来也用于运输其他商品。
Originally, it was to transport grains, and later was used to carry
other commodities.
大运河沿线(定)区域(主)逐渐发展成为(谓)中国的工商业中心。
The areas along the canal have gradually developed into the center of
industry and commerce in China.
长久以来,大运河(主)对中国经济发展(状)发挥了(谓)重要作用(宾)
有力地促进了(已有谓语所以ing)南北地区之间的人员往来和文化交流。
For a long time, it has played a key role in the economic development of
China, promoting the personal exchange and cultural communication between
the north and the south grearly.

单词永远在语境里背

——————-(不论演奏过多少回),the works of Beethoven always attract large audiences.

no matter how many time they have been performed…
no matter how frequently频繁的 they have been performed…
no matter how frequently performed…

When you get men into that state of anger, ——————-(他们很容易出麻烦)

…, they are apt to倾向于 make trouble.
…, It is easy for them to make trouble.

——————-(尽管我很崇拜他是个作家), I don’t like him as a man.

Although I very admire him as a writer…
Him as I admire as a writer…

Only in this way ——————-(我们才能在毕业之后很快适应社会)

can we adapt to society quickly until we graduate

His eyes were reading books ——————-(脑子却在胡乱思想)

but the brain was flying wildly.
but he was thinking about something else.
while his mind was wandering.

阅读全文

Java接口+泛型

2022/5/8

Java接口

接口,在Java编程语言中是一个抽象类型,是抽象方法的集合,接口通常以interface来声明。一个类通过继承接口的方式,从而来继承接口的抽象方法。

接口并不是类,编写接口的方式和类相似,类描述对象的属性和方法

接口无法被实例化,但是可以被实现。一个实现接口的类,必须实现接口内所描述的所有方法,否则就必须声明为抽象类。

接口与类的区别:

  • 接口不能用于实例化对象
  • 接口不能构造方法
  • 接口中所有的方法必须是抽象方法
  • 接口不能包含成员变量,除static和final变量
  • 接口不是被继承了,而是被类实现
  • 接口支持多重继承

接口的声明

[可见度] interface 接口名称 [extends 其他的类名
                     ]{
    //声明变量
    //抽象方法
}

Interface关键词用来声明一个接口

import java.lang.*;
public interface NameOfInterface{
    //任何类型final,static字段
    //抽象方法
}

接口的特性:

  • 接口是隐式抽象的,当声明一个接口的时候,不必使用abstract关键字
  • 接口中的方法都是公有的
interface Animal{
    public void eat();
    public void travel();
}

接口的实现

当类实现接口的时候,类要实现接口中所有的方法,否则类必须声明为抽象的类

类使用implements关键字实现接口,在类声明中Implements关键字放在class声明后面

...implements 接口名称[. 其他接口. 其他接口...]
...
/*文件名:MammalInt.java*/
public class MammalInt implements Animal{
    public void eat(){
        sout("Mammal eats");
    }
    public void travel(){
        sout("Mammal travels");
    }
    public int noOfLegs(){
        return 0;
    }
    public static void main(String args[]){
        MammalInt m = new MammalInt();
        m.eat();
        m.travel();
    }
}
运行结果:
Mammal eats
Mammal travels

重写接口中声明的方法时

  • 类在实现接口的方法时,不能抛出强制性异常,只能在接口中,或者继承接口的抽象类中抛出该强制性异常
  • 类在重写方法时要保持一致的方法名,并且应该保持相同或者相兼容的返回值类型

在实现接口的时候:

  • 一个类可以同时实现多个接口
  • 一个类只能继承一个类,但是能实现多个接口
  • 一个接口能继承另一个接口
//文件名:Sports.java
public interface Sports{
public void setHomeTeam ( String name ) ;
public void setVisiting'Team ( String name ) ;
}

//文件名: Football.java
public interface Football extends Sports{
public void homeTeamScored ( int points ) ;
public void visitingTeamScored ( int points) ;
public void endofQuarter ( int quarter ) ;
}

//文件名:Hockey.java
public interface Hockey extends Sports{
public void homeGoalScored ( ) ;
public void visitingGoalScored ( );
public void endOfPeriod ( int period ) ;
public void overtimePeriod ( int ot ) ;
}
Hockey接口自己声明了四个方法,从Sports接口继承了两个方法
这样实现Hockey接口的类需要实现六个方法

接口的多重继承

在Java中,类的多重继承是不合法,但接口允许多重继承

在接口的多重继承中extends关键字只需要使用一次,在其后跟着继承接口

public interface Hockey extends Sports, Event

接口允许多重继承,而Sports及Event可能定义或者继承相同的方法

标记接口

最常用的继承接口是没有包含任何方法的接口

标识接口作用:给某个对象打个标(盖个戳),使对象拥有某个或者某些特权

public interface EventListenner{}

建立一个公共的父接口:这是由几十个其他接口扩展的Java API,你可要使用一个标记接口来建立一组接口的父接口

向一个类添加数据类型:实现标记接口的类不需要定义任何接口的方法,该类通过多态性变成一个接口类型

Java泛型

泛型,即“参数化类型”,泛型的本质是为了参数化类型,也就是说在泛型使用中,操作的数据类型被指定为一个参数,这种参数类型可以用在类、接口和方法中,分别被称为泛型类、泛型接口、泛型方法。

泛型方法

该方法在调用时可以接收不同类型的参数,根据传递给泛型方法的参数类型来调用。

泛型类

就是在类名后面添加了个类型参数声明部分

泛型类的类型参数声明部分也包含一个或多个类型参数,参数间用逗号隔开。一个泛型参数也被称为一个类型变量

public class Box<T>{
    private T t;
    
    public void add(T t){
        this.t = t;
    }
    
    public T get(){
        return t;
    }
    
    public static void main(String[] args){
        Box<Integer> integerBox = new Box<Integer>();
        Box<String> stringBox = new Box<String>();
        integerBox.add(new Integer(10));
        stringBox.add(new String("Hello World"));
        sout("Integer Value :%d\n\n",integerBox.get());
        sout("String Value :%s\n\n",stringBox.get());
    }
}

运行结果:
Inerger Value :100
String Value :Hello World
阅读全文

刘晓艳作文—段落

2022/5/7

段落

因果递进论证 (第一句话一般都是虚拟语气)

如果我们多读书,就怎么了……(视野↑ - 知识多↑ - 成功) [顺着往下说]

常 用连词:
  • B results from A A因…导致B,因为…
  • B is a result of A B是A的结果,产生影响
  • A result in b 导致了
  • A causes / bring about / give rise to / lead to B

举例:暴力游戏

If teenagers and youngsters spent more time playing violent video games, they would imitate these actions, becoming isolated from others. As a result, they would never communicate with others, which leads to more crimes committed by the young. In the end, there would be more worrying problems in our society.

举例:Why students should be encouraged to develop effective communication skills.

If university students could develop effective communication skills, they could make more friends. In additio ns, the more friends they have, the more comfortable life they will have on campus. As a result, they will have a better learning environment, which consequently lead to a more harmonious context throughout the nation.

举例:The use of translation apps

The more popular translation apps become, the more time will be saved, which thus results in the effciency of our work. That means more tasks could be completed in a certain period. As a consequence, Chinese economy will be boosted a lot.

分类论证(在论述sth的危害或影响时适用)

  • 比如说盗版/假冒产品/不良广告的危害:对个人/集体/社会/国家

the importance of mutual understanding and respect in interpersonal relationships.

In a dormitory, if every member could understand and respect each other, they might become more creative and effective in their study. In addition, it is such mutual understanding in interpersonal relationships that will result in a warm campus environment. In the end, there would be less conflict throughout our country. How desirable the vision is.

  • 科技发展的好处

Firstly if technology develops quickly, we can benefit a lot, saving a lot of time and energy.

Then, it could lead to the rapid development of our whole country, producing more products in limited time.

  • PPT广泛应用

The use of PowerPoint is becoming increasingly popular in calss

The use of PowerPoint, to begin with, will make the knowledge more clear for students in class, thus, it is easy for them to master the key points. In addition, teachers could save a lot of time and make their classes more vividly.

举例论证

  • 阅读名著的好处

我的一个朋友,从小就阅读了大量名著,她的爱好就是读名著,每次和他谈话总觉得他的知识面很宽,很博学,作文写得也很好。

举例开头:

  • Although numerous cases are available for this argument, the following one about my XXX is the most suitable.

  • Countless cases can account for / are responsible for / contribute to the phenomenon / situation / my point, but this / these will suffice.

  • I can figure our no better illustration than the folllowing one.

  • although there are numerous cases in our daily life, the following one is the most typical.

总结:all in all, in conclusion

  • the story tells us that…
  • this case effectively clarifies the fact that…

为什么孩子要远离暴力游戏?

Although there are numerous cases in our daily life, the following one is the most typical. I have a younger brother who was naughty but cute. When he was in primary school, he learned to play video games from his classmates. At the beginning, there no abnormal signs-He went to school normally and returned home normally. Suddenly, one day, he hurt one of his friends cruelly with a knife, which was incredible to all the families. This example effectively clarifies a truth that kids can be easy to imitate behaviors from these games, which might lead to serious consequences.

文章

For this part you are allowed 30misnutes to write an essay on
whether violent video ganmes online will cause students' violent
behaviors. You should write at least 120 words but no more than 180 words.
  • 引出中心 + 个人观点

==With the rapid development of science and technology, there is a hot debate about violent video games online. From my perspective, these games will not cause violent behaviors among teenagers and youngsters.==

  • 原因引出 + 原因分析(2~3)

(and 并列两个句子 加了定语、状语) + (举三个并列句子) + (if引导虚拟语气)

The reasons for this is not far to seek. First of all, by playing online games, students (who have to spend most of their time on study and prepare various examinations) can relieve the pressure (in real life) and find like-minded peers to communicate with. In addition, these young men know clearly that online video games are virtual. At the same time the violent elements in games are unrealistic. As a consequence, the violence in online games has little impact on real life. In the end, if they were interested in something they like, there would be less violent behaviors in our society.

==[First and formost , Addtionally , Last but not least]==

[The fact that … suggest that …]

  • 总结句(总结 + 措施 + 口号)

==To sum up, it is my belief that== violent online games will not result in students violent tendency. it is necessary that parents lead their children to right directions. Only in this way can these kids make use of these games properly.



For this part you are allowed 30misnutes to write an essay online
dictionaries.You can start your essay with the sentence"The use of
online dictionaries is becoming increasingly popular."You should 
write at least 120 words but no more than 180 words.
  • 引出中心 + 个人观点

In light of the rapid improvement of science and technology)the use of online dictionaries is becoming increasingly popular, (which has been brought into the limelight under modern confiditions.) As far as I am concerned, we should attach importance to online dictionaries now and in the future.

  • 原因引出 + 原因分析(2~3)

The popularity of online dictionaries, (which really brings much convenience to the everyday life and study of youngsters,) may be explained by many reasons. The main factor is that using online dictionaries can save us plenty of time, which proves to be in accord with people’s pursuit for higher efficiency. Then more importantly, (it is so convenient for us to look up words on the web) because we can efforlessly and rapidly find what we want by tapping words or phrases and the answer comes in no more than several seconds. So why bother to take a thick dictionary whenever or wherever?

  • 总结句(总结 + 措施 + 口号)

In short, it is a sound conclusion that can be drawn that the use of online dictionaries, to some extent, is beneficial to English learners. So it might the right time to download one to serve us in our daily life.

议论文

第一段引出主题 + 论述观点

引出主题:

  • Recently with the development / advance / progress of science and technology, the phenomenon of … has aroused wide concern.
  • Nowadays, it is undeniable that … has almost become the biggest concern of the present-day world.
  • There is no doubt that the issue about sth has caused wide public attention recently.
  • Recently with the rapid development of science and technology, there is a hot debate about

表示个人观点:

  • In my opinion / as far as I am concerned / from my perspective that…(就我而言…东西好/不好)

第二段**分析原因**的总起句(三大论证方法)

原因引出:

  • The reasons for this is not far to seek.

原因分析:

  • The majority of people would agree that sth(use online dictionaries) has its deep roots.

  • As we know, recognizing a problem is the first step in finding a solution.

  • First and formost , Addtionally , Last but not least

    The fact that … suggest that …

第三段总结 措施 倡议段

总结:

  • From what has been mentioned above, we can safely draw the conclusion that…
  • It is high time that enough attention should be poured into this problem.
  • In short, it is a sound conclusion that can be drawn that…
  • To sum up, it is my belief that

措施:我们、政府、家长、学校

  • Student, from their early age, could be educated / proposed to learn the advantages and disadvantages of living in big cities.
  • Teachers could broadcast the importance of reading books among students.
  • it is necessary that

倡议:

  • So shouldn’t 人 pay much attention to the problem of …
  • So under no account could 人 divert attention from the issue of sth.
  • Only in this way can…

书信作文

第一段问候语+写作目的(比较熟) / 自我介绍+写作目的(不熟)

  • I am delighted to know that you have a strong desire to learn Chinese in recent days. Therefore, the letter, to be honest, is to recommend a city for you.

不熟

自我介绍:I am a freshman from the department of (专业) in this university

写作目的:The aim of my letter is to (文章会给出)

第二段2~3个原因分析

  • When the idea occurs to me, the first 8 city flashing in my mind is Beijing, the capital of China. Firstly, there exists language environment which plays a key role in the process of language learning. As a result, as a modern city, it provides an excellent language environment for language learners. Besides, in one of the biggest cities, people are open-minded, hospitable, and inclusive. You will soon find that you can make friends with them quickly.

第三段总结/感谢+期待回信

表示感谢:

  • I take the opportunity to show my hearfelt apperciation for your generous assistance you rendered me.

期待回信:

XXXXXXXXXXXXXXXXXXXXXXXXXXX

Finally, I hope that you could take my suggestions into serious consideration, and I am looking forward to your reply at your earliest convenience. Good luck to you with all aspects of life. Yours sincerely, Li Ming

报告作文

第一段时间日期+发生事+事的结果(成功/失败)

  • On June 18, Sunday, a volunteer activity in the local Nursing House was organized by the Student Union which proves to be as success.

第二段活动具体是什么事(目的 + 内容 + 感受 + 意义)

  • The activity was aimed at encouraging students to visit the elderly at the Nursing House and help elderly people deal with their troubles in their life. Many students volunteered to participate in this good deed and were engaged in helping the elderly here out by making their meals, washing their clothes and chatting with them. When asked about those volunteers’ feelings about such an experience, all of them responded with a smile, saying “What a wonderful experience and I really appreciate this acticity beacause it makes me learn to care about those who are in heed.”

第三段总结

  • To sum up, the activity is quite successful not only for the elderly but for those students involved.

·

阅读全文

基础语法

2022/5/1

名词性从句(主语、宾语、表语、同位语从句)

形容词性从句(定语从句)

副词性从句(状语从句)

简单句

先找谓语(动词),后面有两坨区分

  • 主谓双宾(直宾 / 间宾) (和动词有直接关系的叫直接宾语)
She will make him a good wife
主谓双宾 him为间接宾语 可放后面
She will make a good wife for him

I bring you a wife => bring wife 所以wife是直接宾语

直宾间宾可以互换位置,但要加介词

I bring a wife for you

A visit to elderly people brings them great laughter and joy.
(主 + 谓 + 间宾 + 直宾)
A          to elderly people brings great laughter and joy to them.
(主 + 谓 + 直宾 + 介词 + 间宾)
The unchecked growth of the tourism may render the environment(seriously polluted)
(主 + 谓 + 宾 + 宾补)

如何区分那两个? 在中间加be动词,如果通顺就是(宾+宾补)

  • **动词有直接关系的叫直接宾语 **
  • 宾补 与 宾 有关系

宾语是对动词的引述 表语是对主语的补充

要写主谓宾 就要找是否有 实义动词

要写主系表 就要看动词确实是无实义

765trdx海湖最深处25.5米
The deepest point of Qinghai lake reaches 25.5 meters. 主谓宾,自己加个实义动词
The maximum depth of Qinghai lake is 25.5 meters. 主系表,谓语确定无实义
泰山方圆约400平方公里
Mount Tai covers an area of about 400 square kilometers.

主谓宾 和 主系表的区分 看 中间的词有没有具体含义

Peer pressure has a positive side.
主 + 谓 + 宾
Mutual trust is not a luxury, but it is a necessity.
主 + 系(无实义) + 表(主补)

系动词/谓语动词:

  • 动词
    • 实义动词
      • 及物vt (及1个物)
        • 主谓宾
        • 主谓双宾[直宾、间宾]
        • 主谓宾宾补
      • 不及物vi (及2个物)
        • [主谓] [不及物动词后面不加宾语 或者 必须接介词再加宾语]
    • 无实义动词
      • 系动词[主系表(主从)]

并列句

两个或以上独立分句,通过并列连词链接,各分句主谓完整,各分句意思同等重要,互相独立

  • 主要连词:and,or,but,yet

主谓一致

主谓一致指谓语动词必须在人称和**数(单复数)**与句子的主语保持一致

围绕着动词可以结合(三态一否:时态、语态、情态、否定)

主语 谓语/系动词
第三人称/单数 is / was / has / 实义动词要在词尾加 -s 或 -es
复数 are / were / have / 实义动词

意义一致:指主谓一致取决于主语的实际意义

  • All of the apples are rotten. 所有的苹果都烂了
  • All of the apple is rotten. 整个苹果都烂了
  • The rest of the lecture is wonderful.
  • 50% of the students in our class are girls.
  • A number of new books are on the desk.
  • The number of students in you class is 50.

I + am/was/have/like

You + are/were/have/like

He/She/It + is/was/has/likes (第三人称单数)

They + are/were/have/like

时态语态

时态:时间的状态

语态:主动或被动

时态(重点8个)

英语中的及物动词一般都有主动语态和被动语态两种形式。被动语态由助动词**be+过去分词(done)**构成。

助动词be随着主语的人称、数、时态和语气的不同而变化。(时态也可以加被动的BUFF噢~)

过去完成时 一定要有过去的那个(时间) => (现在是12月,5月之前在长沙举办过了一个比赛)

时态 一般 进行 完成 完成进行
现在 do/does be doing have/has done have/has been doing
过去 did was/were doing had done had been doing
将来 will do will be doing will have done will have been doing
过去将来 would do would be doing would have done would have been doing

现在完成时:We have learned English for more than ten years.

现在完成进行时:We have been learning English for the past three months. (从过去到现在一直在做的一个动作)

  • Do
  • did过去式:一般过去式
  • done过去分词:完成时态;被动结构be+done;非谓语
  • 不规则动词变化表

时态翻译练习(若没有明显的时间提示 就都写一般现在时)

  • 人们通常在春节和其他节日期间表演狮子舞。(先找句子主干 时间放后面)

    People often play (perform) the lion dance during the Spring Festival and other festivals.

  • 它已逐渐演变成了中国文化的独特元素。(从过去到现在 => 现在完成时)

    It has gradually become a special element of Chinese culture.

  • 唐朝始于618年,终于907年,(唐朝)是中国历史上最灿烂的时期。(一般过去时,一般现在时[陈述事实])

    The Tang Dynasty began in 618 and ended in 907, and it is the most splendid (glorious) period in Chinese history.

    The Tang Dynasty was from in 618 and ended in 907, which and it is the most splendid (glorious) period in Chinese history.

被动语态翻译练习 (中文会省略”被”字,要学会感受中文被动) => [楼盖好了,桥修好了]

  • 剪纸被用来装饰门窗和房间。**(泛指s)**

Paper cuttings are used to decorate doors, windows and rooms.

  • 上世纪90年代(?主语)安装缆车以来,参观人(de)数大大增加。 (缺主语 把宾语变成主语然后被动,有since主句用现在完成时)

Since cable cars were installed (used) in the 1990s, the number of visitors has increased sharply.

  • 核能是可以(被)安全(de)开发和利用的。

Nuclear power(energy) can be explored / developed and used safely.

  • 整个义务教育阶段,(?)要求学生(被动)在每学期期末参加期末考试。(缺主语 把宾语变成主语然后被动) Compulsory course:必修课

Throughout the whole period of compulsory education, students are required to take the final exam at the end of each term.

  • 今年在长沙(?)举行了一年一度的外国人汉语演讲比赛。 (对象 for sb 对于谁而言)(一般过去时)(主语是比赛 所以是was)

An annual Chinese speech contest for foreigners was held in Changsha this year.

复合句

看复杂的句子先找主句然后再找主干(主句表达主要意思 从句表达次要意思)

三大从句

  • 名词性从句(主语/宾语/表语可以充当名词)
    • 主语从句(识别及理解、It形式主语的类型)
    • 宾语从句
    • 表语从句
    • 同位语从句
  • 形容词性从句
    • 定语从句
  • 副词性从句
    • 状语从句

主语从句(把主语变成了一个句子)

主语从句的识别及理解、It形式主语的类型

开头为That / Whether(是否) 或者 主语 就是主语从句(截止到第二个动词前)

[That the little boy got the first prize] made his family relatives (so proud).
主(主从) + 谓 + 宾 + 宾补
==> It made his family relatives so proud that the little boy got the first prize.
{That people often experience trouble sleeping in a different bed in unfamiliar 
surroundings} is a phenomenon (known as the "first-night" effect).
主{主从} + 系 + 表 + (后置定语)
That无成分,无含义,不能省
Whether such taxes work is a matter of debate.
主(主从) + 系 + 表
[How students ultimately handle stress] may depend on their personal 
test-taking abilities.
主(主从) + 谓 + 宾
形式主语(若it不确定何种意思 就为形式主语 => 寻找真正的主语)

①后面的to do ②后面的that

In today's job market, it's not uncommon for job seekers to submit 
applications for many positions.
It = to submit applications for many positions
[{It's} commonly known] that certain diseases are linked with occupations like
lung disease in coal miners.

常见的形式主语句型

It is surprising that... 令人惊讶的是...
It is obvious that... 显而易见的是...
It's said that... 据说...
It's reported that... 据报道...
It's commonly known that... 众所周知, ...
It is a fact that... 事实上是...
It is a common knowledge that ... 众所周知,...
It + be + 形容词 + that ...
It + be + 过去分词 + that ...
It + be + 名词 + that...

宾语从句(及物动词后 or 介词后)

及物动词后的宾语从句(不及物动词 + 介词 + 宾语)

介词后的宾语从句

我明白了 -> 后面的一个字说不清 要一个句子()
I have learned [that love, not time, heals all wounds.]
heal:V.治愈    
wound:n.创伤,伤口
Therefore, {it is vital that} educators everywhere take a careful look not only at 
[what is being done], but also at [what should be done] in the field of computer 
education.
{}内的为 主从
[]内的为 宾从 现在进行时被动

表语从句

动词 后面的就是 表语从句 One is(是什么…)

There are tow worring features of the slowdown. One is [that it has been particularly sharp
in the world's most populous countries, India and China.]  

同位语从句(用一句话来解释一个抽象名词)

解释一个抽象名词,它是什么……

同位语不是主干(主谓宾、主系表……) [前面的名词n]和 [后面的名词n] 地位相同的时候

把和前面相同的名词变成一个句子 => 同位语从句

There is a popular saying that [family happiness spurs social stability.]
a saying = family happiness spurs social stability

[n -> 句子] 用一个句子代替名词:名词性从句

在句子的主干中能**代替名词的成分有:主语、宾语、表语、同位语**



练习

Whether the eyes are "the windows of the soul" is debatable; that they are
intensely important in interpersonal communication is a fact.

{Whether the eyes are “the windows of the soul” } is debatable;

{that they are intensely important in interpersonal communication} is a fact. [主语从句] [they -> eyes]

It is reported {that 49 million Americans are unsure of [where they will
find their next meal.]}
Dr.White said (that) his team wanted to see {whether living in greener utban areas had
a lasting positive effect on people's sense of well-being} or {whether the effect
also disappeared after a period of time.}
As a teacher who has worked in four countries, I have had the experience [that a student
who earns good marks is generally a good student],and [that a student's final mark in
a subject is usually a grade average of the year's work.]
两个定语从句 两个同位语从句

定语从句(类似于形容词,其功能是划定一个范围)

规定一个范围 但是用一个形容词搞不定 所以成为了一句话 因此变成了从

一个形容词作定语修饰名词或代词。

若要表达更复杂的意思,则需要借助一个句子来修饰名词

I don't like (lazy) people.
I don't like people (who don't love their own country.)

定语从句:先行词 + 关系词 + 定语从句

I don’t like people (who don’t love their own country.)

  • 先行词:被修饰的名词、代词,总在定语从句前面 [people]
  • 关系词(关系代词,关系副词) 连接主句和从句指代先行词在定语从句中充当一定成分的词 [who 充当主语]
    • 简要作用:(连接、指代、充当成分)
  • 定语从句:不完整的句子

先行词:一个短语句子

Another trend【that looks significant in 2015】is (that America's largest population
group, Millennials, will continue to put off buying a house.)
主 + 【v+...】 + v
【】定从    []宾从        
()表从     {}主从
And exercise releases hormones【that can improve mood and relieve stress】
,【which can also help learning.】
先行词:hormones
关系词:that,which(这)代替前面一整个句子【exercise ... stress】

关系代词:词 => 替代一个东西的词 (表中前三个)

关系副词:定语从句标识符 (表中后三个)

  • 时间名词 + when
  • 地点名词 + where;
  • reason + why

[介词 + 关系代词 = 关系副词]

先行词 关系词 充当从句成分
事 / 物 which / that 主语 / 宾语
who / whom / that 主语 / 宾语
人 / 物 (所属关系) whose 定语
时间 when 状语
地点 where 状语
reason原因 why 状语
【】定从 []宾从 ()表从 {}主从 <>同位语从句
We found that[for some lottery winners]【who had won more than 500,000 prounds】
the positive effect was definitely there, but after six months to a year,
they were back to the baseline.
关系代词(who 代指前面的 winners)
定语从句-关系副词 when
Our schools need both the talent and the organization to educate each child
【who arrives at the school door.】Some show up ready, but many do not at
this critical time【when young brains are developing rapidly.】
At this critical time: 在这一关键时刻
When: 此时,在这时
定语从句-关系副词 where
Recently I attended several meetings【where we talked about ways to retain
students and keep younger faculty members from going elsewhere.
where:在这里,在...地方
retain:保持,保留,挽留
定语从句-关系副词 where
The center of American automobile innovation has in the past decade moved
2,000 miles away. It has migrated from Detroit to Silicon Valley,【where
self-driving vehicles are coming to life.】
has moved:现在完成时        in the past decade:时间状语
It:代指汽车研发中心          
定语从句-关系副词 why
This is the reason【why I was absent from that meeting.】
The reasons why【I recommend Beijing can be listed as follows...】
定语从句-介词 + 关系代词    
[先行词 + 介词 + which / whom]    modify: v.修改,改变
[介词 + 关系代词 = 关系副词]
Furthermore, humans have the ability to modify the environment(in which) 
they live.
Furthermore, humans have the ability to modify the environment where they live.
英语中通常不用介词收尾,常常把介词提到关系代词前。the environment which they live (in)

限定性定语从句 与 非限定性定语从句

区别在于表达方:

  • 如果想写 那一帮出租司机都绕路了 就用限定性定语从句(限定:给它限定个范围)

  • 如果想写 所有出租车司机都绕路了 就用非限定性定语从句(不做限定)

【限制性】:知道那里堵车的出租司机换了另一条路。
The cab drivers who knew about the traffic jam took another road.
The cab drivers,who knew about the traffic jam,took another road.
【非限定性】(非:不限定 ==> 不让它范围有变化)(用逗号隔开)
The cab drivers took another road,who knew about the traffic jam.
出租司机都换了另一条路,出租车司机都知道那里堵车了。
【限定】:(有一帮女儿是老师,其他的不确定噢~)
She has tow daughters who are teachers.
她有两个(是老师的)女儿.[可能有其他女儿 只不过有两个做老师的女儿]
    
【非限定】:(隔开了就是不限定 没有限制范围 所有的女儿都是老师)
She has tow daughters,who are teachers.
她只有这两个女儿,这两个女儿都是老师

限定性定语从句 与 同位语从句

定语从句会缩小范围 => [不知道听到的新闻是什么…]

同位语从句是 一个句子 和 一个名词 进行对等 => [知道新闻的内容:林肯被谋杀了]

定从:
The news【that you heard】is not true.
that: 指代news 做you heard的宾语
在定语从句中关系词that有含义、充当句子成分
同位语从句: 林肯在剧院遭到谋杀的新闻是真的
The news <that Lincoln was murdered at a theater> is true.
that: 不充当任何成分,去掉句子照常通顺(句子完整)
在同位语从句中that无含义,不充当句子成分
The fact <that artisans,【who were looked on as mechanics or skilled
workers in the eighteenth century,】are frequently considered artists
today> is directly attributable to the Arts and Crafts Movement of 
the nineteenth century.
be attributable to: 可归因于    artisan: n.工匠,技工    mechanic:n.机械师
The fact抽象名词 fact是主语 <that为同位语从句 一直到> 谓语
that同位语从句中有动词:,are   工匠经常在今天被认为是艺术家 ↓(这个事实的原因)    
who定语从句中有动词:were looked  (原因:就是十九世纪的那场运动)
所以The fact的动词就是在后面的 is
句子结构:主 <that同位语从句:主【who非限定性定语从句:主谓宾】+谓+宾> +系+表
★翻译原则★:剥洋葱一样从内往外一层一层的翻译
★ 在18世纪的时候工匠通常被人们认为是机械师或技术工人,而到了今天人们会认为工匠是艺术家,
这个事实最主要的原因是十九世纪的这场运动。
阅读全文

刘晓艳作文—基础

2022/4/30

四级写作常考的题型:

  • 论说文
  • 书信
  • 其他(新闻稿等)

时间:30分钟(3min审题与构思 + 20min + 2)

字数:120~180words(12行-15行)

具体要求:

  • 语言**第一位单词**:正确 多变 语法:正确 多变

  • 结构**第二位结构:句子和句子之间一定要多用逻辑关系词**

    • 表示因果(世界上最重要的一种关系就是因果关系)

      • 表示原因:

        (becausein that,as,since) + 句子

        (because of = due to = owing to = thans to) + n/ving

      • 表示结果:

        so = hence = therefore = thereby = thus = consequently

        = in consequence = as a result / consequence

    • 表示对比

      • 表示”相似性的”对比

        likewise = similarly = equally = simultaneously

        = at the same time = in the meanwhile

      • 表示”差异性的”对比 (但是)

        but,by contrast = conversely = alternatively

        = on the contrary = on the other hand = otherwise

        = while = whereas

    • 表示递进

      besides = also = in addition = moreover = furthermore

      ​ = apart / aside from this

    • 表示让步 (虽然尽管)

      • [ (Desipite(介) = in spite of ) + n / ving ] = not withstanding = although

        = though = as = while = even (if) = much as(用于句首)

        = granting / granted that

      • Undoubtedly = there is no doubt that… 毫无疑问的是…

      • it may be true that… 或许真实的是…

      • there is no denying that… 不可否认的是

    • 表示引出新对象

      • about = concerning = regarding = with regard to

        = as for / to = in respect of 关于

      • in terms of 就…而论,在…方面

      • when it comes to …当提到…时

    • 表示总结

      • on the whole = all in all = overall = in conclusion / summary / general

        = generally(speaking) = as a whole = mainly = substantially = to sum up

        = conclude = come to the conclusion 总的来说

        = in short / brief = in a word 简而言之

    • 表示举例

      • such as = for instance / example = a good case in point = to illustrate

        = as an illustration

  • 内容**第三位**:(不重要 只是用来凑字数)

句子的类型

被动There beIt结构(头重脚轻+强调句)、复合句(同位语+同位语从句,定语+定语从句,状语+状语从句)、虚拟语气(if+it is necessary)、倒装(so…that+only-状语)

  • 结构上分为:简单句 并列句 复合句(名词性从句,定语从句,状语从句)

  • 语序上分为:倒装和正常语序

  • 语态上分为:主动和被动

被动结构

(一句话中只能有一个做谓语,其他的多余动词要做非谓语)

一句话上来先找主谓(定语态 定时态) 剩下的东西以状语形式出现

当一句话需要动词却没有动词,可以永远加Be

  • 前面在修路:The road is being built in front.
  • 全球在变暖:It is becoming warm throughout the world
  • 狗没有找到:The dog wasn’t found
  • 北京西站就要到了:We are arriving at BJ station
  • 他看着我,笑着离开了:He saw me,smiling and leaving
  • 有很多人喜欢冬泳:There are a host of children and adults liking to swim in winter
  • 有意义就是好好活:Being meaningful is to live well

There be句型

当一句话没有主语,并且谓语动词“有”的时候就可以考虑写成 There be 句型

目前关于孩子和父母的关系问题有一个激烈的讨论
There is a hot debate about the topic on the relationship between
parenys and therir chilidren.
毫无疑问线上词典在大学生中越来越受欢迎
There is no denying that online dictionaries are becoming increasingly popular with college students.
有两个原因可以解释我的观点
There are tow arguments to account for my perspective
account 不算是谓语 因为前面有介词 变成了动词不定式

[语法详解:There be句型的使用规则(含练习题及答案) - 知乎 (zhihu.com)](https://zhuanlan.zhihu.com/p/147350559#:~:text=语法详解:There be句型的使用规则 (含练习题及答案) 1 1.There is%2B单数可数名词%2F不可数名词%2B其他 如:There is,some students on the playground. … 5 5.Therebe句型的一般疑问句)

it结构

【】定从 []宾从 ()表从 {}主从
  • 避免头重脚轻

    动名词充当主语可以放句首

    不定式充当主语可以放在句末

    • 动词不定式充当主语的时候:把动词不定式放在句末去,加it来做形式主语

      打你是我的错
      Beating you is my fault.
      It is my fault to beat you.
      
    帮助更多的同学建立自信是我们这次活动的目的(主系表)
    【Helping more students build confidence】is our purpose of this activity.
    Our purpose of this activity is to h elp more students build confidencce.
    
  • 主语从句

    显而易见,众所周知:可以写开头、中间、结尾(可以写在任何一个句子前面)

    (推荐第一段 以及 第二段前方)

    观点看法:perspective、outlook、standpoint

    • It is common knowledge that… 显而易见,众所周知
    • It is my belief that… = I think that… 我认为
    • It is self-evident that… 显而易见,众所周知
    • It has been found that… 显而易见,众所周知
    • It is beyond dispute that… 显而易见,众所周知
    • It is universally acknowledged that… 显而易见,众所周知
    • It has been widely accepted that… 显而易见,众所周知
    • It is generally agreed that… 显而易见,众所周知
    ①大学教育极大地促进了社会的进步是显而易见的
    It is beyond dispute that university education promotes the progress of our society obviously.
    
    ②我认为养宠物这个话题现在应该引起人们的关注了
    It is my perspective that the issue about raising pets should be brought into the limelight under
    modern conditions.
    
  • 强调句型(谓语不能强调,其余可以强调)

    it is…that…

    ③也是在明代,由郑和率领的船队曾到印度洋进行了七次大规模探险航行
    it is also in the Ming Dynasy that the ships led by ZhengHe went to the Ocean
    ④随着时间的推移,丝绸之路逐渐变成了一条连接东西方的主要道路,促进了东西方的经济文化交流
    As time went by, it is the Silk Road that gradually became a major road
    connecting the East and the West, promoting economic and cultural exchanges
    between the two parties.
    

复合句

同位语的使用:解释名词的成分(这辈子只能出现在名词后面)

名词做同位语就是(在名词后 再加一个名词解释前面那个名词)

只要在作文中见到名词,都可以在他后面再加一个名词作为它的同位语出现

Hunting for jobs,<a hot topic among undergraduates,> has become the public concern recently.
Optimism, a positive attitude, plays a key role in the general routine of everyday living.
他已经找到了女朋友这件事情 使家人很开心
简单:The matter makes his families rejoiced.
复杂:The matter that he has found a girlfriend makes his families rejoiced.

名词 + that + … + suggest that + …

The fact that … suggest that …【第二段分析原因时使用】

在大城市生活会增加每天通勤的成本这个事实表明,你在大城市生活会更容易疲倦
The fact that it will increase the cost of your daily commute suggests that
you tend to get tired more easily in big cities.
当地人非常的好客热情这个事实表明,你会爱上这座城市,不愿意离开的
The fact that the locals are very hospitable and friendly shows that you will love this city,
unwilling to leave there.
(因为一句话已有一个动词存在love 所以unwill要变成非谓语)

定语和定语从句

只要在作文中见到名词,都可以有意识的在作文中加入定语的成分

介、短、定从、非谓语、名词 => 可修饰名词

      • 先找主谓宾,再加定状补!!!
I love the girl singing on the stage
I love the girl who is singing on the stage
I love the girl in front of me (介词短语修饰名词)
I love the mother of that girl (名词修饰名词)
I love the girl of kindness (名词修饰名词)
I love the girl being as kind as an angel (非谓语修饰名词)
I love the girl who keeps so kind (定语从句修饰名词)
  • 我们应该尊重那些正在为梦想奋斗穷孩子
We should respect poor children who are struggling for their dreams.(主从)
We should respect poor children struggling for their dreams. (非谓语)
  • 被上帝抛弃的那个男人最终死去了 (at last时间状语比较灵活)
The man who was abandoned by God died at last. (过去分词做定语) 
  • 那个老人在他儿子到达的那天去世了(只有在缺少成分的时候才用that)

(此句子用when 因为句子不充当成分)

The old man died on the day when his son arrived
  • 在舞台上唱歌的那个女孩子大雁的女儿
The girl singing on the stage is the daughter of DaYan.
  • 这是一个关于月亮和六便士的故事(专有名词前面加the )(介词短语修饰名词)
This is a fiction about the moon and six pence.
  • 龙井是一种绿茶,主要产自中国东部沿海的浙江省(which可用于指代前面的名词)
Longjing is a type of green tea which is mainly produced in
zhejiang Province, the coastal area in east China. 
Longjing is a type of green tea which come from zhejiang 
Province, near the sea.
  • 乌镇是浙江的一座古老水镇,坐落在京杭大运河畔
Wuzhen,which is an ancient water town in Zhejiang province, is located by
the beijing-Hangzhou Grand Canal.
    
Wuzhen is an ancient water town in Zhejiang province, which is located by
the beijing-Hangzhou Grand Canal.
  • 功夫是中国武术的俗称。中国武术的起源可以追溯到自卫的需要、狩猎活动以及古代中国的军事训练。它是中国传统体育运动的一种,年轻人老年人都练。
Kung Fu is the common name of chinese train which come from protect oneself needs, 
hungting animals and army training in ancient China. Besides, it is a traditional
Chinese sport that both the young and the elderly can practise.
  • 剪纸是中国最流行的传统民间艺术形式之一,中国剪纸有一千五百多年的历史,在明朝和清朝时期特别流行
Paeper cutting is one of the most popular arts in china which has a 1500-year history and was quite famous in the Ming and Qing dynasties.
  • 中国人自古以来就在中秋节庆祝丰收,这与北美庆祝感恩节非常相似
Chinese have had the tradition to celebrate harvesrt in the Middle-Autumn Festival, 
which proves quite similar to Thanks giving Day in north America.

状语从句

只要确定不是主谓宾,只要没有跟在名词后做定语同位语

作文中任何一个地方都可以加状语从句

成分:(介、短、定从、非谓语、名词 )

主 谓 宾 表

同位语解释名词 定语修饰名词 状语修饰除名词以外的所有成分

  • 什么是状语:除了名词不能修饰 其余什么都可以修饰

He looks extremely handsome (形容词做状语)

At last, succeeded at a highcost(介词短语做状语)

  • 状语的成分:1. adv 2. 介词短语 3.非谓语动词 4.从句

  • 状语的使用:

    • 时间状语
    • 地点状语
    • 原因状语
    • 目的状语(目的是…,为了…)
    • 条件状语(如果…)
    • 结果状语(so…that,如此…以至于)
    • 方式状语(by、through,通过……)
    • 让步状语(althrough,虽然…尽管)
    • 伴随状语(with)
    • 比较状语(as…as,than…)
    • 副词
I love my girlfriend...
原因状语:I love my girlfriend without any reasons
目的:I love my girlfriend in order to marry her

虚拟语气

表示与事实相反,或者语气委婉

在第二段原因处可使用

If引导的条件状语从句(主将从现)

如何把一个正常条件状语从句变成一个虚拟语气?

只需要把已经写好的句子的时态,变成它的过去式

  • 过去的过去 => 过去完成时
If you are a tear in my eye, I will never shed it.
If you were a tear in my eye, I would never shed it.
    
If I was a dog last night, I could sleep in bed with you.
If I had been a dog last night, I could have slept in bed with you.

一般过去时(跟时) 和 现在完成时(一段时间 => 我在河北已经10年了),

在虚拟语气中be的过去式只有were;could = would = might

如果她能嫁给一个有钱人,她的母亲可能会善待她吧
If she married a rich man her mother could treat her well.
If she had married a rich man he mother could have treated her well.
如果你花更多的时间在阅读上,你就能更开阔自己的视野
If you spent more time reading, you would broaden your horizons more.
  • …很重要…很必要 It is necessary / important that 【从句用**(should + 动词原形)** 表示虚拟】

在第三段措施处可使用

大学生多参加活动尽快地融入到新环境中是非常必要的
It is necessary that college students should take part in more activities and
integrate into the new environment as soon as possible.
  • 是…的时候了

在第三段第一句 、最后一句可使用(喊口号)

It is high time that…(从句用过去式表示虚拟)

是我们关注这个问题的时候了
It is high time that we put emphasis on th issue.

倒装

就是把一句话写成一般疑问句的形式,给一句话提个be动词助动词放在句首

倒装的具体用法: (前面倒装 后面不动)

  • so…that… 结构的句子将so引导的部分置于句首时用倒装,如此…以至于

作文中出现 形容词/副词 的地方 都可以写成so…that句型,所有的 形容词/副词 都可以倒装

He was so excited that he cannot help laughing at midnight.
-> So excited was he that he cannnot help laughing at midnight.
She looks so gorgeous that she can catch the eyes of everyone.
So gorgeous does she look that she can catch the eyes of everyone.
DaYan runs so quickly that crazy dogs fail to catch up with her.
So quickly does DaYan run that crazy dogs fail to catch up with her.
  • “only + 状语” 位于句首时用倒装
His girlfriend called his name only once.
Only once did his girlfriend call his name.
My dearest Tom always lives only in my deep heart.
Only in my deep heart does my dearest Tom always live.
The problem could be resolved only in this way.
Only in this way could the problem be resolved.

句子的扩写

([同 + 定]加在名词后)(状语均可)

I love Dayan
I, (a university student from the department of Physical education) love
dayan (who is the most graceful and elegant teacher I have ever seen.)
Violent video games will make children violent.
Violent video games (which are popular online everywhere) will make children
violent (in their daily life beacause they tend to imitate these negative behaviors.)
Pollution keeps exceedingly serious.
Pollution, (a global issue), keeps exceedingly serious (with the rapid urbanization 
and development of technology.)
阅读全文

Java日期+方法+文件流+scanner+异常+继承+重写载+多态+抽象+封装

2022/4/30

Java日期时间

java.uti包提供了Date类来封装当前的日期和时间

Data() 构造函数使用当前日期和时间来初始化对象
Data(long millisec) 构造函数接收一个参数从1970年1月1日起的毫秒数

获取当前日期时间

import java.util.Date;

public class DateDemo{
    public static void main(String args[]){
        //初始化Date对象
        Date date = new Date();
        //使用toString()函数显示日期时间
        sout(data.toString());
    }
}
运行结果:
Mon May 04 09:51:52 CDT 2013

使用SimpleDateFormat格式化时间

SimpleDateFormat是一个以语言环境敏感的方式来格式化和分析日期的类。允许你选择任何用户自定义日期时间格式来运行

import java.util.*;
import java.test.*;

public class DateDemo{
    public static void main(String args[]){
        Date dNow = new Date();                     //DateFormat格式化编码
        SimpleDateFormat ft = new SimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz");
        sout("Current Date: " + ft.format(dNow));
    }
}
运行结果:
Current Date: Sun 2004.07.18 at 04:14:09 PM PDT

Java休眠(sleep)

下面的程序会休眠3秒

import java.util.*;
public static void main(String args[]){
    try{
        sout(new Date() + "\n");
        Thread.sleep(5*60*10); //1秒 = 1000毫秒
        sout(new Date() + "\n");
    } catch(Exception e){
        sout("Got an exception!");
    }
   }
}

Calendar类

Calendar类是一个抽象类,在实际使用时实现特定的子类的对象,创建对象的过程只需要使用getInstance方法创建即可

创建一个代表系统当前日期的Calendar对象

  • Get设置
//获得年份
int year = c1.get(Calendar.YEAR);
  • Set设置
Calendar c1 = Calendar.getInstance(); //默认是当前日期
public void set(int field, int value)
c1.set(Calendar.DATE, 10);
c1.set(Calendar.YEAR, 2008);
  • Add设置

把c1对象的日期加上10,也就是c1所表的日期的10天后的日期,其他所有的数值都会被重新计算

c1.add(Calendar.DATE, 10);
  • GregorianCalendar类

Calendar类实现了公历日历,GregorianCalenda是Calendar类的一个具体实现

import java.util.*;
public class GregorianCalendarDemo{
    public static void main(String args[]){
        String months[] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
        int year;
        //初始化Gregorian日历
        //使用当前时间和日期
        //默认为本地时间和时区
        GergorianCalendar gcalendar = new GergorianCalendar();
        //显示当前时间和日期的信息 sout 为 print 不是 println
        sout("Date: ");
        sout("months[gcalendar.get(Calendar.MONTH)]");
        sout(" " + gcalendar.get(Calendar.DATE) + " ");
        sout(year = gcalendar.get(Calendar.YEAR));
        sout("Time: ");
        sout(gcalendar.get(Calendar.HOUR) + ":");
        sout(gcalendar.get(Calendar.MINUTE) + ":");
        sout(gcalendar.get(Calendar.SECOND));
        //测试当前年份是否为闰年
        if(gcalendar.isLeapYeay(year)){
            sout("当前年份是闰年");
        }
        else {
            sout("当前年份不是闰年");
          }
    }
}
运行结果:
Date: Apr 22 2009
Time: 11:25:27
当前年份不是闰年

Java方法

System.out.println()

println()是一个方法(Method),而System是系统类(Class),out是标准输出对象(Object)

这句话的用法是调用系统类System中的标准输出对象out中的方法println()

方法的定义

修饰符 返回值类型 方法名 (参数类型 参数名){
    ...
    方法体
    ...
    return 返回值:
}
  • 修饰符:是可选的,告诉编译器如何调用该方法,定义了该方法的访问类型
  • 返回值类型:方法可能会返回值。returnValueType是关键字void
  • 方法名:是方法的实际名称
  • 参数类型:当方法被调用时,传递值给参数。这个值被称为实参或变量。参数列表是指方法的参数类型、顺序和参数的个数
  • 方法体:方法体包括具体的语句,定义该方法的功能

void方法的调用一定是一个语句,没有返回值,像任何以分号结束的语句一样

通过值传递参数

连续n次打印一个消息:

public static void nPrintln(String message, int n){
    for(int i = 0; i < n; i++)
        sout(message);
}

方法的重载

一个类的两个方法拥有相同的名字,但是有不同的参数列表

构造方法

当一个对象被创建时候,构造方法用来初始化该对象。构造方法和它所在类的名字相同,但构造方法没有返回值。

通常会使用构造方法给一个类的实例变量赋初值,或者执行其他必要的步骤来创建一个完整的对象

不管你是否自定义构造方法,所有的类都有构造方法,因为Java自动提供了一个默认构造方法,它会把所有成员初始化为0

//一个简单的构造函数
static class Myclass{
    int x;
    //以下是构造函数
    MyClass(int i){
        x = i;
    }
}
//调用构造方法来初始化一个对象
public class ConsDemo{
    public static void main(String args[]){
        MyClass t1 = new MyClass(10);
        MyClass t2 = new MyClass(20);
        sout(t1.x + " " + t2.x);
    }
}
运行结果:
10 20

可变参数

Java支持传递同类型的可变参数给一个方法

typeName...parameterName

在方法声明中,在指定参数类型后加一个省略号(…)

一个方法中只能指定一个可变参数,它必须是方法的最后一个参数,任何普通的参数必须在它之前声明

public calss VarageDemo{
    public static void main(String args[]){
        //调用可变参数的方法
        printMax{34,3,3,2,56.5};
        printMax(new double[]{1,2,3});
    }
    
    public static void printMax(double...numbers){
        if(numbers.length == 0){
            sout("No argument passed");
            return;
        }
        double result = numbers[0];
        for(int i = 1; i < number.length; i++)
            if(number[i] > result){
                result = numbers[i];
            }
        sout("The max value is " + result);
    }
}

Java流(Stream)、文件(File) 和 IO

Java.io包几乎包括了所有操作输入、输出需要的类。所有这些流类代表了输入源和输出目标

一个流可以理解为一个数据的序列、输入流表示一个源读取数据输出流表示一个目标写数据

读取控制台输入

Java的控制台输入由System.in完成

为了获得一个绑定到控制台的字符流,你可以把System.in包装在一个BufferedReader对象中创建一个字符流

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

BufferedReader对象创建后,我们可以使用read()方法从控制台读取一个字符,或者用readLine()方法读取一个字符串

从控制台读取多字符输入

从BufferedReader对象读取一个字符要使用**read()**方法

从BufferedReader对象读取一个字符串要使用**readLine()**方法

int read() throws IOException

每次调用read()方法,它从输入流读取一个字符并把该字符作为整数值返回。当流结束的时候返回-1。该方法抛出IOException

下面的程序用read()方法从控制台不断读取字符知道用户输入”q”

//使用BufferedReader 在控制台读取字符
import java.io.*;
public class BRRead{
    public static void main(String args[]) throws IOException{
        char c;
        //使用System.in创建BufferedReader
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        sout("输入字符,按下'q'键退出.");
        //读取字符
        do{
            c = (char) br.read();
          //c = br.readLine();
            sout(c);
        } while(c != 'q');
    }
}

运行结果:
输入字符,按下'q'键退出.
123abcq
1
2
3
a
b
c
q
FileInputStream

该流用于从文件读取数据,它的对象可以用关键字new来创建,有多重构造方法可用来创建对象。

可以使用字符串类型的文件名来创建一个输入流对象来读取文件:

InputStream f = new FileInputStream("C:/java/hello");

也可以使用一个文件对象来创建一个输入流对象来读取文件,先使用File()方法创建一个文件对象

File f = new File("C:/java/hello");
InputStream f = new FileInputStream(f);
FileOutputStream

该类用来创建一个文件并向文件中写数据

如果该流在打开文件进行输出前,目标文件不存在,那么该流会创建该文件

有两个构造方法可以用来创建FileOutputStream对象

使用字符串类型的文件名来创建一个输出流对象

OutputStream f = new FileOutputStream("C:/java/hello");

也可以使用一个文件对象来创建一个输出流来写文件,先使用File()方法创建一个文件对象

File f = new File("C:/java/hello");
OutputStream f = new FileOutputStream(f);
Java中的目录
创建目录:

File类中有两个方法可以用来创建文件夹:

  • **mkdir()**方法创建一个文件夹,成功则返回true,失败则返回false,失败表明File对象指定的路径已经存在,或者由于整个路径害不存在,该文件夹不能被创建
  • **mkdirs()**方法创建一个文件夹和它的所有父文件夹

Java Scanner类

Scanner对象的基本语法:

Scanner s = new Scanner(System.in);

通过Scanner类的next() 与 **nextLine()**方法获取输入的字符串

在读取前我们需要使用 hasNexthasNextLine 判断是否还有输入数据。

使用next方法:

import java.util.Scanner;
public class ScannerDemo{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        sout("next方式接收:");
        //判断是否还有输入
        if(scan.hasNext()){
            String str1 = scan.next();
            sout("输入的数据为: " + str1);
        }
    }
}
输出结果:
next方式接收
youj com
输入的数据为:youj
使用nextLine方法:
import java.util.Scanner;
public class ScannerDemo{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        sout("nextLine方式接收: ");
      //判断是否还有输入
        if(scan.hasNextLine()){
            String str2 = scan.nextLine();
            sout("输入的数据为: " + str2);
        }
    }
}
输出结果:
next方式接收
youj com
输入的数据为:youj com
next() 与 nextLine() 区别

next():

  • 一定要读取到有效字符后才可以结束输入
  • 对输入有效字符之前遇到的空白,next()方法胡自动将其去掉
  • 只有输入有效字符才能将其后面输入的空白作为分隔符或结束符
  • next()不能得到带有空格的字符串

nextLine():

  • 以Enter为结束符,也就是说nextLine()方法返回的是输入回车之前的所有字符
  • 可以获得空白

如果要输入int或float类型的数据,在Scanner类中也有支持,但是在输入之前最好先使用hasNextXxx() 方法进行验证,再使用 nextXxx()来读取:

import java.util.Scanner;
public calss ScannerDemo{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int i = 0;
        float f = 0.0f;
        sout("输入整数: ");
        if(scan.hasNextInt()){
            //判断输入的是否是整数
            i = scan.nextInt();
            sout("整数数据: " + i);
        } else{
            sout("输入的不是整数!");
        }
        sout("输入小数: ");
        if(scan.hasNextFloat()){
            //判断输入的是否是小数
            f = scan.nextFloat();
            sout("小数数据: " + f);
        } else{
            sout("输入的不是小数!");
        }
    }
}

Java异常处理

捕获异常 try/catch

使用 try 和 catch关键字可以捕获异常,try/catch 代码块中的代码成为保护代码

try{
    //见识代码执行过程,一旦发现异常则直接跳转至catch,
    //如果没有异常则直接跳转至finally
} catch (ExceptionName e1){
    //Catch快 可选执行的代码块,如果没有任何异常发生不会执行
    //如果发现异常则进行处理或向上抛出
} finally{
    //必选执行的代码块,不管是否有异常发生
    //及时发生内存溢出异常也会执行,通常用于处理善后清理工作
}
throws/throw关键字

如果一个方法没有捕获一个检查性异常,那么该方法必须使用throws关键字来声明

一个方法可以声明抛出多个异常,多个异常之间用逗号隔开

import java.io.*;
public class className{
    public void withdraw(double amount) throws RemoteException, InsufficientFundsException{
        //...
    }
}
finally关键字

用来创建在try代码块后面执行的最后一个 代码块,无论是否发生异常,finally代码块中的代码总会被执行

小综合
public class ExcepTest{
    public static void main(String args[]){
        int a[] = new int[2];
        try{
            sout("Access element three :" + a[3]);
        } catch(ArrayIndexOutOfBoundsException e){
            sout("Exception thrown :" + e);
        } finally{
            a[0] = 6;
            sout("First element value: " + a[0]);
            sout("The finally statement is executed");
        }
    }
}
运行结果:
Exception thrown :java.l

Java继承

如果类A是类B的父亲,而类B是类C的父亲,我们也称类C是A的子类,类C是从类A继承而来的,在Java中,类的继承是单一继承,一个子类只能拥有一个父类。

继承中最常使用的两个关键词是extendsimplements

这两个关键字的使用决定了一个对象和另一个对象是否是一个关系,我们能实现一个对象获取另一个对象的属性

所有Java的类均是由java.lang.Object类继承而来的,所以Object是所有类的祖先类,而除了Object外,所有类必须有一个父类。

通过extends关键字可以申明一个类是继承另一个类而来的

public class A{
    private int i;
    protected int j;
    
    public void func(){
        
    }
}

public class B extends A{
    public int z;
    public void fund(){
        
    }
}
类B由类A继承而来的,类B是类A的子类,而类A是Object的子类,这里可以不显示地声明
作为子类,类B的实例拥有类A所有的成员变量,但对于private类型的成员变量类B却没有访问权限
这保障了类A的封装性
public class Animal{}
public class Mammal extends Animal{}  Animal类是Mammal类的父类
public class Reptile extends Animal{} Animal类是Reptile类的父类
                                       Mammal类和Reptile类是Animal类的子类   
public class Dog extends Mammal{} Dog类既是Mammal类的子类 又是 Animal类的子类
//通过使用关键字 extends,子类可以继承父类的除privat属性外所有的属性
//通过使用 instanceof 操作符,能够确定左边的对象是不是右边类的实例
public class Dog extends Mammal{
    public static void main(String args[]){
        Animal a = new Animal();
        Mammal m = new Mammal();
        Dog d = new Dog();
        sout(m instanceof Animal);
        sout(d instanceof Mammal);
        sout(d instanceof Animal);
    }
}
运行结果
true
true
true

HAS-A关系

HAS-A代表类和它的成员之间的从属关系,有助于代码的重用和减少代码的错误。

public class Vehicle{}
public class Speed{}
public class Van extends Vehicle{
    private Speed sp;
}
//Van类将实现的细节对用户隐藏起来,因此,用户只需要知道怎样调用Van类来完成某一功能
//而不必知道Van类是自己来做还是调用其他类来做这些工作

Java只支持单继承,一个类不能继承多个类

(×) public class test extends Animal, Mammal{}  (×)

Java只支持单继承(继承基本类抽象类),可以用接口来实现(多继承接口实现)

public class Apple extends Fruit implements Fruit1, Fruit2{}
一般继承基本类和抽象类用extends关键字,实现接口类的继承用implements关键字。

重写

重写重要的地方是返回值形参都不能改变,外壳不变,核心重写!

重写的好处在于子类可以根据需要,定义特定与自己的行为。

class Animal{
    public void move(){
        sout("动物可以移动");
    }
}
class Dog extends Animal{
    public void move(){
        sout("狗可以跑和走");
    }
  /*  
      public void bark(){
        sout("狗可以吠叫");
    } 
  */
}
public class TestDog{
    public static void main(String args[]){
        Animal a = new Animal();
        Animal b = new Dog();
        a.move();
        b.move();
       // a.bark();//此处会报错,因为a的引用类型Animal没有bark方法
    }
}
运行结果:
动物可以移动
狗可以跑和走

尽管b属于Animal类型,但是它可以运行Dog类的move方法

方法重写的规则

  • 参数列表与被重写方法的参数列表必须完全相同
  • 返回类型与被重写方法的返回类型可以不相同,但是必须是父类返回值的派生类
  • 子类方法的访问权限必须大于或等于父类方法的访问权限:如果父类的一个方法被声明为public,那么在子类中重写该方法就不能声明为protected
  • 父类的成员方法只能被它的子类重写
  • 声明为final的方法不能被重写
  • 声明为static的方法不能被重写,但可以被再次声明
  • 子类和父类在同一个包中,那么子类可以重写父类所有方法,除了声明为private和final的方法
  • 子类和父类不在同一个包中,那么子类可以重写父类的声明为public和protected的非final方法
  • 构造方法不能被重写
  • 如果不能继承一个方法,则不能重写这个方法
  • 权限受阻:如果父类的一个方法被声明为public,那么在子类中重写该方法就不能声明为protected

Super关键字的使用

当需要在子类中调用父类的被重写方法时,要使用super关键字

class Animal{
    public void move(){
        sout("动物可以移动");
    }
}
class Dog extends Animal{
    public void move(){
        super.move();
        sout("狗可以跑和走");
    }
}
public class TestDog{
    public static void main(String args[]){
        Animal b = new Dog();
        b.move();
    }
}
运行结果:
动物可以移动
狗可以跑和走

重载

重载是在一个类里面,方法名字相同,而参数不同,返回类型可以相同也可以不同

每个重载的方法(或者构造函数)都必须有一个独一无二的参数类型列表

重载规则:

  • 被重载的方法必须改变参数列表
  • 被重载的方法可以改变返回类型
  • 被重载的方法可以改变访问修饰符
  • 被重载的方法可以声明新的或更广的检查异常
  • 方法能够在同一个类中或者在一个子类中被重载
  • 无法以返回值类型作为重载函数的区分标准

重写和重载的区分

重写 bark(方法名和参数都一样)
class Dog{
    public void bark(){
        sout("woof ");
    }
}
class Hound extends Dog{
    public void sniff(){
        sout("sniff ");
    }
    public void bark(){
        sout("bowl");
    }
}
重载 bark(方法名相同,参数不同)
class DOg{
    public void bark(){
        sout("woof ");
    }
    public void bark(int num){
        for(int i = 0; i < num; i++){
            sout("woof ");
        }
    }
}
区别点 重载方法 重写方法
参数列表 必须修改 一定不能修改
返回类型 可以修改 一定不能修改
异常 可以修改 可以减少或删除,一定不能抛出新的或更广的异常
访问 可以修改 一定不能做更严格的限制(可以降低限制)

Java多态

多态是同一种行为具有不同表现形式或形态的能力

多态性是对象多种表现形式的体现

宠物=小猫+小狗+蜥蜴

public interface Vegetarian{}
public class Animal{}
public class Deer extends Animal implements Vegetarian{}

当我们将引用型变量应用于Deer对象的引用

Deer d = new Deer();
Animal a = d;
Vegetarian v = d;
Object o = d;
所有的引用型变量d,a,v,o都指向堆中想通的Deer对象

多态的实现方式

  • 重写
  • 接口
  • 抽象类和抽象方法

Java抽象类

在Java面向对象的概念中,所有的对象都是通过类来秒回的

如果一个类中没有包含足够的信息来描绘一个具体的对象,这样的类就是抽象类

抽象类除了不能实例化对象之外,类的其他功能依旧存在:成员变量、成员方法、构造方法

由于抽象类不能实例化对象,所以抽象类必须被继承,才能被使用(通常在设计阶段决定要不要设计抽象类)

抽象方法

如果你想设计一个类:包含一个特别的成员方法,该方法的具体实现由它的子类确定,那么你可以在父类中声明该方法为抽象方法。

Abstract关键词同样可以声明抽象方法,抽象方法只包含一个方法名,没有方法体

抽象方法没有定义,方法名后面直接跟一个分号,而不是花括号

public abstract class Employee{
    private String name;
    private String address;
    private int number;
    public abstract double computePay();
    //其余代码
}

声明抽象方法会造成以下两个结果:

  • 如果一个类包含抽象方法,那么这个类必须是抽象类
  • 任何子类必须重写父亲的抽象方法,或者声明自身为抽象类

继承抽象方法的子类必须重写该方法。否则子类也必须声明为抽象类。最终,必须有子类实现该抽象方法,否则,从最初的父类到最终的子类都不能用来实例化

如果Salary类继承了Employee类,那么它必须实现computePay()方法

public class Salary extends Employee{
    private double salary;
    public double computePay(){
        sout("Computing salary pay for " + getName());
        return salary/52;
    }
}

Java封装

封装是一种将抽象性函式接口的实作细节部分包装、隐藏起来的方法

封装可以被认为是一个保护屏障,防止该类的代码和数据被外部类定义的代码随机访问

要访问该类代码和数据,必须通过严格的接口控制

封装最主要的功能在于我们能修改自己的实现代码,而不用修改那些调用我们代码的程序片段

适当的粉装可以让代码更容易理解和维护,也增强了代码的安全性

public class EncapTest{
    private String name;
    private String idNum;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdNum() {
        return idNum;
    }

    public void setIdNum(String idNum) {
        this.idNum = idNum;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

public方法是外部类访问该类成员变量的入口,这些方法称为getter和setter方法

因此,任何要访问类中私有成员变量的类都要通过这些getter和setter方法

public class RunEncap{
    public static void main(String args[]){
        EncapTest encap = new EncapTest();
        encap.setName("James");
        encap.setAge(20);
        encap.setIdNum("12343ms");
        sout("Name : " + encap.getName() 
           + "Age: " + encap.getAge());
    }
}
运行结果:
Name : James Age : 20
阅读全文

Java基础+对象和类+变量类型+修饰符+运算符+各种类+数组

2022/4/28

Java基础语法

  • 对象:对象是类的一个实例,有状态和行为。例如,一条狗是一个对象,它的状态有:颜色、名字、品种;行为有:摇尾巴、吃、叫等。

  • :类[class]是一个模板,它描述一类对象的行为和状态

  • 方法:方法就是行为,一个类可以有很多方法。

  • 实例变量:每个对象都有独特的实例变量,对象的状态由这些实例变量的值决定。

  • 编写java时应注意几点:

    大小写敏感

    类名:对所有类来说,类名的首字母应该大写。如果类名由若干单词组成,那么每个单词的首字母应该大写:MyFirstJavaClass

    方法名:所有的方法名都应该以小写字母开头。如果方法名含有若干单词,则后面的每个单词首字母大写。

    源文件名:源文件名必须和类名相同。当保存文件时,你应该使用类名作为文件名保存(切记Java是大小写敏感的),文件名的后缀为java。

    主方法入口:所有的Java程序由public static void main(String[] args)方法开始执行。

  • Java变量:局部变量、类变量(静态[static]变量)、成员变量(非静态变量)

  • 方法:访问权限符 返回值 方法名(参数列表){ 方法体 }

    ​ public void method() {sout(“Hello”);}

    interface:接口,一种抽象的类型,仅有方法和常量的定义

    implements:表示一个类实现了接口

    abstract:抽象方法,抽象类的修饰符

    extends:表示一个类是另一个类的子类(继承)

    private:表示私有字段,或者方法等,只能从类内部访问

    protected:表示字段只能通过类或者子类访问,子类或者在同一个包内的其他类

    public:表示共有属性或方法

    static:表示在类级别定义,所有实例共享的

    throw:抛出异常

    throws:定义方法可能抛出的异常

  • 继承:在Java中,一个类可以由其他类派生,如果你要创建一个类,而且已经存在一个类具有你所需要的属性或方法,那么你可以将新创建的类继承该类,利用继承的方法,可以重用已存在类的方法和属性,而不用重写这些代码。被继承的类称为超类(super class),派生类称为子类(subclass)

  • 接口:在Java中,接口可理解为对象间互相通信的协议。接口在继承中扮演着很重要的角色。接口值定义派生要用到的方法,但是方法的具体实现完全取决于派生类。

Java对象和类

  • Java中的类和方法[方法就是行为,一个类可以有很多方法]
public class Dog{
    String breed;
    int age;
    String color;
    
    void barking(){
        
    }
    void hungry(){
        
    }
    void sleeping(){
        
    }
}

一个类可以拥有多个方法,在上面的例子中:barking()、hungry()、sleeping() 都是Dog类的方法


构造方法

每个类都有构造方法,不主动创建编译器将会为该类提供一个默认的构造方法,在创建一个对象的时候,至少要调用一个构造方法。构造方法的名称必须与类同名,一个类可以有多个构造方法。

public class Puppy{
    public Puppy(){
        
    }
    public Puppy(String name){
        //这个构造器仅有一个参数:name
    }
}

创建对象

对象是根据类创建的。在java中,使用关键字new来创建一个新的对象。

  • 声明:声明一个对象,包括对象名称和对象类型
  • 实例化:使用关键字new来创建一个对象
  • 初始化:使用new创建对象时,会调用构造方法初始化对象
public class Puppy{
    public Puppy(String name){
        //这个构造器仅有一个参数:name
        sout("Puppy Name is :" + name);
    }
    public static void main(String[] args){
        //下面的语句将创建一个Puppy对象
        Puppy myPuppy = new Puppy("tommy");
    }
}

打印出下面结果:
Puppy Name is : tommy

访问实例变量和方法

//实例化对象
ObjectReference = new Constructor();
//访问其中的变量
ObjectReference.variableName;
//访问类中的方法
ObjectReference.MethodName();

实例

访问实例变量和调用成员方法:

public class Puppy{
    int puppyAge;
    public Puppy(String name){
        sout("Passed Name is :" + name);
    }
    public void setAge(int age){
        puppyAge = age;
    }
    public int getAge(){
        sout("Puppy's age is :" + puppyAge);
        return puppyAge;
    }
    
    public static void main(String[] args){
        //创建对象
        Puppy myPuppy = new Puppy("tommy");
        //通过方法来设定age
        myPuppy.setAge(2);
        //调用另一个方法获取age
        myPuppy.getAge();
        //也可以这样访问成员变量
        sout("Variable Value :" + myPuppy.puppyAge);
    }
}

输出结果:
Passed Name is :tommy
   's age is :2
PuppyVariable Value :2

源文件声明规则

  • 一个源文件中只能有一个public类

  • 一个源文件可以有多个非public类

  • 源文件的名称应该和public类的类名保持一致。例如:源文件中public类的类名是Employee,那么源文件应该命名为Employee.java

  • 特殊的转义字符序列

\n 换行
\r 回车
\f 换页符
\b 退格
\0 空字符
\s 字符串
\t 制表符

Java变量类型

一个类可以包含以下类型变量:

  • 局部变量:在方法、构造方法或者语句块中定义的变量称之为局部变量。变量声明和初始化都是在方法中,方法结束后,变量就会自动销毁。局部变量是在栈上分配的。局部变量没有默认值,所以局部变量被声明后,必须经过初始化,才可以使用(类方法中的变量)(局部变量的作用域仅限制在被创造的方法中)
  • 成员变量:成员变量是定义在类中,方法体之外的变量。这种变量在创建对象的时候实例化。(独立于方法之外的变量,不过没有static修饰)
  • 类变量:类变量(静态变量)也声明在类中,方法体之外,但必须声明为static类型。无论一个类创建了多少个对象,类只拥有类变量的一份拷贝。静态变量除了被声明为常量外很少使用,常量是指声明为public/private,final和static类型的变量,常量初始化后不能改变。静态变量存储在静态存储区,经常被声明为常量,很少单独使用static声明变量。类变量被声明为public static final 类型时,类变量名称必须使用大写字母,如果静态变量不是public和final类型,其命名方式与实例变量以及局部变量的命名方式一致。(独立于方法之外的变量,用static修饰)

然后是static

static在java中表示静态

但是这个静态又是什么意思呢?

最开始接触static的时候看书上的概念根本没弄懂!

接触有一段时间java了,在这里面要总结一下我对static的理解:

(概念)static表示“全局”或者“静态”的意思,用来修饰成员变量和成员方法,也可以形成静态static代码块,但是Java语言中没有全局变量的概念。

这句话是说,你会用到static修饰一些个变量、方法、方法块什么的,这是你用到static的地方;“但是,java中没有全局变量的概念”,怎么理解这句话?你时刻要记住java是一个面向对象的语言,万事万物皆对象,无论你做什么都需要创建一个对象,然后再调用这个对象的方法,java怎么能允许存在一个在全局都通用的“全局变量”的概念存在呢?所以java中压根就没有所谓的“全局变量”,但是没有这个概念,不代表你不可以实现这个功能,java存在的目的就是让人们使用它去达到人们想要的效果,所以static value就可以达到全局变量的作用,所以,你现在应该可以理解下面这句话了吧。

(概念)用public修饰的static成员变量和成员方法本质是全局变量和全局方法,当声明它类的对象市,不生成static变量的副本,而是类的所有实例共享同一个static变量。

现在进一步理解下面两段概念:

(概念)只要这个类被加载,Java虚拟机就能根据类名在运行时数据区的方法区内找到他们。因此,static对象可以在它的任何对象创建之前访问,无需引用任何对象。

import java.io.*;
public class Employee{
    //salary是静态的私有变量
    private static double salary;
    //DEPARTMENT是一个常量
    public static final String DEPARTMENT = "Development ";
    public static void main(String args[]){
        salary = 1000;
        sout(DEPARTMENT + "average salary:" + salary);
    }
}
输出结果:
Develment average salary:1000
public class Variable{
    static int allClicks = 0;    //类变量
    String str = "hello world"; //实例变量
    public void method(){
        int i = 0; //局部变量
    }
}

实例:

import java.io.*;
public class Employee{
    //这个成员变量对子类可见
    public String name;
    //私有变量,仅在该类可见
    private double salary;
    //在构造器中对name赋值
    public Employee(String empName){
        name = empName;
    }
    //设定salary的值
    public void setSalary(double empSal){
        salary = empSal;
    }
    //打印信息
    public void printEmp(){
        sout("name :" + name);
        sout("salary :" + salary);
}
    public ststic void main(String args[]){
        Employee empOne = new Employee("Ransika");
        empOne.setSalary(1000);
        empOne.printEmp();
    }
}
输出结果:
name : Ransika
salary :1000.0

Java修饰符

访问控制修饰符

  • default 默认的:在同一包内可见,不使用任何修饰符
  • private 私有的:在同一类内可见。私有访问修饰符是最严格的访问级别,所以被声明为private的方法、变量和构造方法只能被所属类访问,并且类和接口不能声明为private。private访问修饰符的作用主要用来隐藏类的实现细节和保护类的数据
public class Logger{
    private String format;
    public String getFormat(){
        return this.format;
    }
    public void setFormat(String format){
        this.format = format;
    }
}

实例中,Logger类中的format变量为私有变量,所以其他类不能直接得到和设置该变量的值。为了使其他类能够操作该变量,定义了两个public方法:getFormat() (返回format的值) 和 setFormat(String) (设置format的值)

  • public 公有的:对所有类可见,被声明public的类、方法、构造方法和接口能够被任何其他类访问。如果几个互相访问的public类分布在不同的包中,则需要导入相应public类所在的包。由于类的继承性,类所有的共有方法和变量都能被子类继承
public static void main(String[] arguments){
    //...(公有访问控制)
}

Java程序的main()方法必须设置成共有的,否则,不能运行该类

  • proteed 受保护的:对同一包内的类和所有子类可见

被声明为protected的变量、方法和构造器能被同一个包中的任何其他类访问,也能够被不同包中的子类访问。protected访问修饰符不能修饰类和接口,方法和成员变量能够声明protected,但是接口的成员变量和成员方法不能声明为protected,子类能访问protected修饰符声明的方法和变量,这样就能保护不相关的类使用这些方法和变量。

下面的父类使用了protected访问修饰符,子类重载了父类的openSpeaker()方法。

class AudioPlayer{
    protected boolean openSpeaker(Speaker sp){
        //实现细节
    }
}
class StreamingAudioPlayer{
    boolean openSpeaker(Speaker sp){
        //实现细节
    }
}

如果把openSpeaker()方法声明为private,那么除了AudioPlayer之外的类将不能访问该方法

如果把openSpeaker()方法声明为public,那么所有的类都能够访问该方法

如果我们只想让该方法对其所在的类的子类可见,则将该方法声明为protected

  • 访问控制和继承规则:
    • 父类中声明为public的方法在子类中也必须为public
    • 父类中声明为protected的方法在子类中要么声明为protected,要么声明为public,不能声明为private
    • 父类中声明为private的方法,不能够被继承

控制非访问修饰符

  • static 修饰符:用来创建类方法和类变量

    • 静态变量:static关键字用来声明独立于对象的静态变量,无论一个类实例化多少对象,它的静态变量只有一份拷贝。静态变量也成为类变量。局部变量不能被声明为static变量
    • 静态方法:static关键词用来声明独立于对象的静态方法。静态方法不能使用类的非静态变量。静态方法从参数列表得到数据,然后计算这些数据

    对类变量和方法的访问可以直接使用classname.variablename 和 classname.methodname的方式访问

    下面为static修饰符用来创建类方法和类变量

public class InstanceCounter{
    private static int numInstances = 0;
    protected static int getCount(){
        return numInstances;
    }
    
    private static void addInstance(){
        numInstances++;
    }
    
    InstanceCounter(){
        InstanceCounter.addInstance();
    }
    
    public static void main(String[] arguments){
        sout("Starting with" + InstanceCounter.getCount() + " instances");
        for(int i = 0; i < 500; ++i){
            new InstanceCounter();
        }
        sout("Created " + InstanceCounter.getCount() + "instances");
    }
}
输出结果:
Started with 0 instances
Created 500 instances
  • final 修饰符:用来修饰类、方法和变量,final修饰的类不能够被继承,修饰的方法不能被继承类重新定义,修饰的变量为常量,是不可修改的

    • final变量:能被显示地初始化并且只能初始化一次。被声明为final的对象的引用不能指向不同的对象。但是final对象里的数据可以被改变,也就是说final对象的引用不能改变,但是里面的值可以改变。final修饰符通常和static修饰符一起使用来创建类常量。
    public class Test{
        final int value = 10;
        //下面是声明常量的实例
        public static final int BOXWIDTH = 6;
        static final String TITLE = "Manger";
        
        public void changeValue(){
            value = 12; //将输出一个错误
        }
    }
    
    • final方法: 类中的final方法可以被子类继承,但是不能被子类修改。声明final方法的主要目的是防止该方法的内容被修改

    如图为final修饰符声明方法

    public class Test{
        public final void changeName(){
            //方法体
        }
    }
    
    • final类: final类不能被继承,没有类能够继承final类的任何特性
    public final class Test{
        //类体
    }
    
  • abstrat 修饰符:用来创建抽象类和抽象方法

    • 抽象类:抽象类不能用来实例化对象,声明抽象类的唯一目的是为了将来对该类进行扩充。一个类不能同时被abstract和final修饰,如果一个类包含抽象方法,那么该类一定要声明为抽象类,否则编译错误。抽象类包含抽象方法和非抽象方法。
    • 抽象方法:是一种没有任何实现的方法,该方法的具体实现由子类提供,抽象方法不能被声明成final和static。任何继承抽象类的子类必须实现父类的所有抽象方法,除非子类也是抽象类。抽象类可以不包含抽象方法。
    abstract class Caraven{
        private double price;
        private String model;
        private String year;
        public abstract void goFast(); //抽象方法
        public abstract void changeColor();
    }
    
    public abstract class SuperClass{
        abstract void m(); //抽象方法
    }
    class SubClass extends SuperClass{
        //实现抽象方法
        void m(){
            // ......
        }
    }
    
  • synchronized和volatile 修饰符: 主要用于线程的编程 (这里不具体研究)


Java运算符

位运算

假设a=60,b=13;

    a = 0011 1100
    b = 0000 1101
----------------------
a & b = 0000 1100
a | b = 0011 1101
a ^ b = 0011 0001
~ a   = 1100 0011

instanceof 运算符

该运算符用于操作对象实例,检查该对象是否是一个特定类型(类类型 或 接口类型)

instanof运算符使用格式如下:

(Object reference variable)instanceof(class/interface type)

如果运算符左侧变量所指的对象,是操作符右侧类或接口(class/interface)的一个对象,那么结果为真

String name = "James";
boolean result = name instanceof String;
//由于name是String类型,所以返回真
class Vehicle{}
public class Car extends Vehicle{
    public static void main(String args[]){
        Vehicle a = new Car();
        boolean result = a instanceof Car;
        sout(result);
    }
}
输出结果:
true

continue关键字 + 增强型for循环

continue适用于任何循环控制结构中,作用是让程序立刻跳转到下一次循环的迭代

for循环中,continue语句使程序立刻跳转到更新语句

while或者do…while循环中,程序立刻跳转到布尔表达式的判断语句

public class Test{
    public static void main(String args[]){
        int {} numbers = {10, 20, 30, 40, 50};
        for(int x : numbers){
            if(x == 30){
                continue;
            }
            sout(x);
            sout("\n");
        }
    }
}
输出结果:
10
20
40
50

Java Number类、Math类、Character类

Number包装类型

byte -> Byte        int -> Integer        short -> Short        long -> Long
double -> Double    float -> Float        boolean -> Boolean    char -> Character

包装类型都是用final声明了,不可能被继承重写。在实际情况中编译器会自动的将基本类型数据装箱成对象类型,或者将对象类型拆箱成基本类型

public static void main(String[] args){
    int num1 = 1;
    //将基本类型数据装箱成对象包装类型
    Integer num2 = num1;
    Integer num3 = 3;
    //将对象数据类拆箱
    int num4 = num3;
}

下面是一个装箱与拆箱的例子:

public class Test{
    public static void main(String args[]){
        Integer x = 5;
        x = x + 10;
        sout(x);
    }
}
输出结果:
15

Math类型

Java的Math包含了用于执行基本数学运算的属性和方法:初等指数、对数、平方根和三角函数

Math的方法都被定义为static形式,通过Math类可以在主函数中直接调用 sout(“90°正弦值:” + Math.sin(Math.PI / 2));

下表是常用的Number类和Math类的方法:

序号 方法与描述
1 xxxValue():将number对象转换为xxx数据类型的值并返回
2 compareTo():将number对象与参数比较
3 equals():判断number对象是否与参数相等
4 valueOf():返回一个Integer对象指定的内置数据类型
5 toString():以字符串形式返回值
6 parseInt():将字符串解析为int类型
7 abs():返回参数的绝对值
8 floor():返回小于等于给定参数的最大整数
9 round():返回一个最接近的int、long型值
10 exp():返回自然数底数e的参数次方
11 log():返回参数的自然数底数的对数值
12 pow():返回第一个参数的第二个参数次方
13 sqrt():求参数的算术平方个
14 random():返回一个随机数

Character类

使用字符时,我们通常使用的是内置数据类型char

  • Character类的用法:可以使用Character的构造方法创建一个Character类对象
Character ch = new Character('a');
----------------------------------
Character ch = 'a';
char c = test('x');
isLetter()是否是一个字母        isDigit()是否是一个数字字符
isUpperCase()是否是大写字母    isLowCase()是否是小写字母
toUpperCase()指定字母的大写形式 isLowerCase()指定字母的小写形式
toString()返回字符的字符串形式,字符串的长度仅为1

注意:String类是不可改变的,所以你一旦创建了String对象,那它的值就无法改变了。

可以通过StringBuffer类 和 StringBuilder类(能够被多次的修改,并且不产生新的未使用对象)

public class Test{
    public static void main(String args[]){
        StringBuffer sBuffer = new StringBuffer("test");
        sBuffer.append("String Buffer");
        sout(sBuffer);
    }
}
输出结果:
test String Buffer
public StringBuffer append(String s) 将指定的字符串追加到此字符序列
public StringBuffer reverse() 将此字符序列用其反转形式取代
public delete(int start, int end) 移除此序列的子字符串中的字符
public insert(int offset, int i) 将int参数的字符串表示形式插入此序列中
replace(int start, int end, String str) 使用给定String中的字符替换此序列的子字符串中的字符

Java数组

声明数组变量

dataType[] arrayRefVar;
double[] myList;

创建数组

Java语言使用new操作符来创建数组

arrayRefVar = new dataType[arraySize];
此语法语句做了两件事:
    ①:使用dataType[arraySize]创建了一个数组
    ②:把新创建的数组的应用赋值给变量arrayRefVar

所以数组的变量声明创建数组可以用一条语句完成

dataType[] arrayRefVar = new dataType[arraySize]

数组的元素时通过索引来访问的,数组索引从0开始,所以索引值从0到arrayRefVar.length-1

定义一个int类型的数组

public class ArrayDemo{
    public static void main(String args[]){
        int data[] = new int[3]; //开辟了一个长度为3的数组
        //在数组使用之前一定要开辟空间(实例化)
        data[0] = 10;
        data[1] = 20;
        data[2] = 30;
        for(int x = 0; x < data.length; x++){
            sout(data[x]);
        }
    }
}

数组作为函数的参数

数组可以作为参数传递给方法

public static void printArray(int[] array){
    for(int i = 0; i < array.length; i++){
        sout(array[i] + " ");
    }
}

printArray(new int[]{3, 1, 2, 6, 4, 2});

数组作为函数的返回值

public static int[] reverse(int[] list){
    int[] result = new int[list.length];
    for(int i = 0, j = result.length - 1; i < list.length; i++, j--){
        result[j] = list[i];
    }
    return result;
}

Arrays类

java.util.Arrays类能方便地操作数组,它提供的所有方法都是静态的

  • 给数组赋值:通过fill方法
  • 对数组排序:通过sort方法,按升序
  • 比较数组:通过equals方法比较数组中元素值是否相等
  • 查找数组元素:通过binarySearch方法能对排序好的数组进行二分查找法操作
public static int binarySearch(Object[], Object key) 
用二分查找算法在给定数组中搜索给定值的对象(Byte,int,double等)
public static boolean equals(long[] a, long[] a2)
如果两个指定的long型数组彼此相等,则返回true。如果两个数组包含相同数量的元素
并且两个元素中的所有相应元素对都是相等的,则认为这两个数组是相等的
public static void fill(int[] a, int val)
将指定的int值分配给指定int型数组指定范围中的每个元素
public static void sort(Object[] a)
对指定对象数组根据其元素的自然顺序进行升序排序
阅读全文

作文模板

2022/4/22

画图作文

首段:图画描述

显然,这幅画能自然联系到做好小事的重要性
This drawing, apparently, can be linked to the critical significance of doing small things.
    
图画中,一个年轻人表达了自己对“核废料处理”的担忧
In the picture, the youngster express his worries about "disposing of nuclear waste".
    
使他感到吃惊的是,他爸爸指着垃圾筐告诉他,如果能把垃圾筐清空,他就能做好一切
To his surprise, his father points at the dustbin, telling him that if he can empty the dustbin there, he can do anything.

二段:图画主题 + 现象 + 意义

父亲的意思是,如果年轻人想要成功
The father means that if young people dream to achieve success,
    - 
就应该明智地从小的工作开始做起
it is sensible for them to start with little jobs.
确实,在当今社会,很多年轻人忽略身边的各种小事已经成为一种常见现象
Admittedly, in the present-day society, it is a common phenomenon for many teenagers to neglect tiny things in life.
    
例如打扫房间、洗衣服和清理垃圾筐
such as cleaning rooms, washing clothes and emptying dustbins.
    
为什么?因为越来越多的年轻人觉得处理这些小事没有用。一个典型例子就是图画中的小孩。
Why? The reason is that a growing number of young people find it rather useless to deal with these things.
A typical example is the boy in the picture.
然而,正是这些小事确保年轻人能掌握足够的知识、能力和经验
Nonetheless, it is these small tasks that ensure young people to master sufficient knowledge, competence and experience.
    
事实上,很多聪明人已经意识到这些小事的重要性
Actually, wise people in large numbers have come to recognize the significance of these small things.

做好这些小事带给我们技能,唤起我们对成功的热情,帮助我们进步
Doing small things brings us skills, arouses our passion for success and helps us to make progress.

尾段:观点 + 建议 + 展望

作为一名大学生,我坚信年轻人很有必要通过做好小事提升自己的整体素质
As a college student, I am convinced that it is exceedingly necessary for young people to strengthen our comprehensive
quality by doing small things. 
因此,我们应该教育和鼓励我们的朋友和熟人培养这种积极的意识和习惯
Accordingly, we should educate and encourage our friends and acquaintances to foster this positive awareness and habit.
如果我们不遗余力地这样来做,未来我们的工作和生活将充满光明和希望
We, sparing no efforts to do so, may witness a hopeful and promising future of our work and study.
每个人都应该就牢记大的成功源于每天小的进步
Everyone should bear in mind that a big success originates from everyday small progress.
阅读全文

社会主义、邓小平理论

2022/4/21

社会主义改造理论

从新民主主义到社会主义的转变

新民主主义社会的性质

中华人民共和国成立社会主义改造基本完成,是我国从新民主主义社会主义的过渡时期

新民主主义社会的特点

  1. 经济成分:个体经济,资本主义经济,社会主义经济
  2. 阶级构成:工人阶级、农民阶级和其他小资产阶级、民族资产阶级等基本的阶级力量
  3. 主要矛盾:工人阶级资产阶级的矛盾

党在过度时期的总路线

1949年党的七届二中全会,提出了使中国“稳步地由农业国转变为工业国,由新民主主义国家转变为社会主义国家”(两个转变同时并举的思想)

党在这个过度时期的总路线和总任务,是要在一个相当长的时期内,逐步实现国家的社会主义工业化,并逐步实现国家对农业、对手工业和资本主义工商业的社会主义改造

党在过渡时期总路线的主要内容被概括为“一化三改”。一化:社会主义工业化。三改:对个体农业、手工业和资本主义工商业的社会主义改造。两者相辅相成,互相促进,体现了解放生产力与发展生产力、变革生产关系与发展生产力的有机统一。

阅读全文
头像
Asuna
You are the one who can always get to me even with screen between us.