关于give用法和短语的文字专题页,提供各类与give用法和短语相关的句子数据。我们整理了与give用法和短语相关的大量文字资料,以各种维度呈现供您参考。如果give用法和短语未能满足您的需求,请善用搜索找到更适合的句子语录。
英语学*最基础的就是词汇量的积累,大量的词汇积累是我们学*英语最重要的。小编为大家精心准备了with的用法,欢迎大家前来阅读。
with词义
1.和……一起;由……陪同;有……在场
Would you like to go to the theatre with us?
你愿意和我们一齐去剧院看戏吗?
The money is on the table with the shopping list.
钱和购物清单都在桌子上呢。
2.随着
With time passing by, they have grown into big boys and girls.
随着时光的流逝,他们都长成大小伙子和大姑娘了。
The shadows lengtheded with the approach of sunset.
随着太阳下落,影子也逐渐伸长。
3.用(表示使用工具或器具)
It is easy to translate with a dictionary.
借助字典进行翻译就会很容易。
You can see it with a microscope.
用显微镜就能看见它了。
4.带有(能够作定语,也能够表伴随)
We need a person with a knowledge of European markets.
我们需要一个熟悉欧洲市场的人。
He looked at her with a hurt expression.
他带着受伤的神情看着她。
5.因为;由于
The small child trembled with fear.
这小孩吓得直打哆嗦。
It is very stuffy in the room, with all the windows closed.
由于窗户都关着,屋子里十分闷。
6.尽管
With all her faults he still loves her.
尽管她有那么多缺点,可他仍然爱着她。
7.用以表示方式、情景、环境或条件
I'll do it with pleasure.
我很高兴做这件事。
She fell asleep with the light on.
她开着灯睡着了。
辨析
1.and 和with
两者都有“和”的意思。and是连词,with是介词。当and连接两个主语时,谓语动词必须是复数;而with要看“真正主语”的单复数,也就是with前方的名词。如:
Tom and his mother often _________(go) shopping on weekends.
Tom with his mother often _________(go) shopping on weekends.
and连接两个主语,Tom和妈妈,两个人肯定是复数,所以要用动词原形go; with 要看前方的主语,是Tom一个人,所以要用单数goes
2.as和with
两者都有“因为”“随着”的意思。不管什么意思,两者的核心区别就在于:as要接从句;with只接短语
With our teacher ing, the class bee silent.
As our teacher es, the class bee silent.
with结构的构成
它是由介词with或without+复合结构构成,复合结构作介词with或without的复合宾语,复合宾语中第一部分宾语由名词或代词充当,第二部分补足语由形容词、副词、介词短语、动词不定式或分词充当,分词能够是此刻分词,也能够是过去分词。
With结构构成方式如下:
1. with或without-名词代词+形容词;
2. with或without-名词代词+副词;
3. with或without-名词代词+介词短语;
for的用法
大家应该都是认识for吧,for是作为一个常见的英语介词,用法很多,了解它的用法,可以为自己学*英语提供了很多方便。下面是小编给大家带来的for的用法,以供大家参考,我们一起来看看吧!
for是个常用词,在英语中出现频率高、含义多、用法广,可以与许多名词、形容词和动词搭配。下面举例说明,希望对同学们学好、用准英语知识能够有所帮助。
一、用作介词。
1.表示目的,意为“为了”。例如:
Ann goes home for holidays every year with her parents.安每年与她父母一起回家度假。
此外,下列动词后跟双宾语,起间接关系作用的介词for均表目的。get/buy/make/draw/play(播放,上演)/save(节约)/find/fly/mend/take/do sb. sth.=get/buy/make/draw/play/end/take/do sth. for sb.
2.表示对象、用途,意为“对于,供,适合于”。例如:
Walking is good for health.散步有利于健康。
Here are books for children.这些是供儿童阅读的书籍。
3.表示目标、去向,意为“往,向”。例如:
I’ll leave for Shanghai.我要前往上海。
What time do you leave home for school?你何时离家上学?
4.表示等值或交换关系,意为“兑,换”。例如:
We can get two tickets for eight yuan.用八元钱,我们可以买两张票。
Don’t put the whole English sentence word for word into Chinese.不要把整个英语句子字对字地译成汉语。
5.表示愿望、爱好、特长等,意为“对于”。例如:
He hopes for the best.他抱着乐观的希望。
The children in China long(vi.渴望) for the Mid-Autumn Festival.*儿童盼望中秋节。
6.表示原因,意为“由于,因为”。例如:
Ann,thanks a lot for asking me to your birthday party.安,多谢你邀请我参加你的生日聚会。
We should thank our mother for doing so much for us.(前一个for表原因,后一个for表目的)我们应当感谢我们的母亲,她为我们做了那么多。
My classmates jumped for joy at the meeting.我的同学们在会上高兴地跳了起来。
7.表示时间、距离、数量,意为“长达……之久,计”。例如:
Hold on for a moment,please.[别挂]请稍等。
He has lived there for nine years.他在那里住了九年。
You can see nothing but trees for two miles.(www.fwsir.com)两英里之内,你只能看见树木。
8.与名词或代词连用,后接动词不定式,构成名词短语。其中介词for后面的名词或代词在逻辑上是不定式的主语。例如:
It’s time for Li lei to go to bed.李雷睡觉的时间到了。
It’s important for us to study English well.学好英语对我们很重要。
9.意为“代替,代表”。例如:
Our English teacher Mr. Wu was ill,so Miss Gao taught for him yesterday.我们的英语老师吴老师病了,所以高老师昨天替他代了课。
WTO is short for World Trade Organization.WTO是世界贸易组织的中文缩写。
10.意为“赞成,拥护”。例如:
Are you for or against?你是赞成还是反对?
How many of you are for the idea?你们多少人赞成这个意见?
11.意为“当做,作为”。例如:
We often mistake Lucy for Lily.我们时常把露西当做莉莉。
Most of the houses are used for the teachers’ offices now.这些房子现在多数用作教师的办公室了。
12.意为“至于,就……而言……”。例如:
He is tall for his age.就年龄而言,他算是高个子。
二、用作并列连词,表示因果关系,意为“因为”。
并列连词for引导的表示原因的从句不能用于句首,较because正式,用于正式文体中,但语气比because弱;回答why引导的问句时,应用because,而不能用for。例如:
You’d better put on your sweater,for it’s rather cold outside.你最好把毛衣穿上,外边相当冷。
I must be off now,for my sister is waiting for me.我得走了,因为我姐姐在等我。
三、用于某些成语,构成固定词组。例如:
1.for days(years) 连续多日(年)
2.for ever 永远
3.for long 长久
4.long for 渴望
5.care for 关怀,照顾
remind的用法
在**淡淡的学*中,看到知识点,都是先收藏再说吧!知识点在教育实践中,是指对某一个知识的泛称。想要一份整理好的知识点吗?以下是小编为大家收集的remind的用法知识点,仅供参考,大家一起来看看吧。
remind有想起、提醒的意思。以下是小编带来的remind的`用法,希望对你有帮助。
(1) remind(vt.) 使(人)想起,使记起
① remind sb. of sb. / sth. 使……想到某人或某物 He reminds me of his father. 看到他使我想起他的父亲。
② remind sb. that-clause 使人回忆起…… The sight of the clock reminded me that I was late. 看到钟使我想起我已经晚了。
(2) remind(vt.) 提醒
① remind sb. of / about sth. 提醒某人某物;提醒某人注意某事Be sure to remind her of the meeting she has to attend. 务必提醒她要参加那次会议。
② remind sb. to do sth. 提醒某人做某事Please remind me to post the letter. 请提醒我寄那封信。
③ remind sb. that-clause 提醒某人…… She reminded me that I hadn't written to mother. 她提醒了我,我还没给妈妈写信。
【练*试题】what you said just now ____ me of that American professor.
A. mentioned B. informed C. reminded D. memorized
[考查目标] remind基本用法。
[答案与解析]C remind表示“提醒;让……想起”。
remind的用法
remind的用法1:remind的基本意思是指通过一定的媒介或激发而慢慢想起某事(做过或应做某事)。这事可以是全然忘却的,也可以是一时想不起来的; 这媒介则是引起人们回忆的外界人或事物。
remind的用法2:remind只用作及物动词,可接名词或代词作宾语,也可接双宾语,其直接宾语可由带或不带疑问词的动词不定式、that从句或以疑问词引导的从句充当。
remind的用法3:remind常和介词of连用,表示“提醒注意未来的事”或“使想起过去的事”的内容, of的宾语可以是名词、动名词,也可以是疑问词引导的从句。
remind的用法4:remind作“提醒”解时与remind about同义,其主语只能是人,作“使想起”解时主语通常是事物。
remind的用法5:remind sb of sth/ v -ing/wh-clause属双宾语结构, of引起的短语是直接宾语,可以把remind sb that/wh-clause中的从句看作是其前省略了介词of。
remind的用法6:可以把remind sb to- v 中的to- v 看作是直接宾语
remind相关例句
Remind me to phone Alan before I go out.
提醒我在出去之前给艾伦打电话。
‘ You had an accident, ’ he reminded her.
他提醒她道:“你出过一次事故了。”
You remind me of your father when you say that.
你说这样的话,使我想起了你的父亲。
Passengers are reminded no smoking is allowed on this train.
旅客们请注意,本次列车禁止吸烟。
That smell reminds me of France.
这股气味使我想起了法国。
however的用法
英语单词的产生是汉英两种语言双向交流的产物,一些带有*特色的名称和概念进入了英语词汇,同时还有一些英语词汇进入了汉语,在文化环境中衍生出新的含义,形成了英语词汇的语义文化特征。以下是小编精心整理的however的.用法,欢迎大家分享。
however
[英][haev(r)][美][haev]
adv.然而; 可是; 无论如何; 不管到什么程度;
conj.不管怎样;
1、用作副词,注意以下用法:
(1) 表示让步,意为“无论如何”“不管怎样”,用来修饰形容词或副词,其词序为:however+形容词或副词+主语+谓语。这样用的however其实具有连词的功能,用以引导一个让步状语从句。如:
However much he eats, he never gets fat. 不管他吃多少,他永远吃不胖。
However cold it is, he always goes swimming. 不管天有多冷,他都去游泳。
However far it is, I intend to drive there tonight. 不管有多远,我今晚也要开车到那儿去。
这样用的 however 与 no matter how 大致同义。如:
No matter how much he eats, he never gets fat.
No matter how cold it is, he always goes swimming.
No matter how far it is, I intend to drive there tonight.
有时从句谓语可用情态动词。如:
Don’t laugh, however funny it may be. 无论多么有趣也不要笑。
I’ll try to finish it in time, however hard it may be. 无论多么难,我也要按时完成。
另外,“however+形容词或副词+主语+谓语”有时可以有所省略。如:
I refuse, however favourable the conditions. 不管条件如何有利,我都不干。(conditions后省去了are)
I’d rather have a room of my own, however small (it is), than share a room. 无论房间多么小,我宁愿一个人住一间,而不愿意与别人合住一个房间。
A grammar rule, however true (it is), is useless unless it can be understood. 一条语法规则,不管如何正确,除非能懂,否则毫无用处。
(2) 表示转折,尤其用于谈及一个既成事实时,表示转折,其意为“可是”“仍然”等。可放在句首、句中或句末,通常用逗号与句子其他成分隔开。如:
My father, however, did not agree. 但是,我父亲不同意
My room is small; however, it’s comfortable. 我的房间很小,但却很舒服。
He said that it was so; he was mistaken, however. 他说情况如此,可是他错了。
注意,however不能像 but(但是)那样直接连接两个句子(注意正句中的标点符号)。如:
我们都已尽了最大的努力,不过我们还是输了。
误:We all tried our best, however we lost the game.
正:We all tried our best, but we lost the game.
正:We all tried our best; however, we lost the game.
正:We all tried our best. However, we lost the game.
(3) 表示惊奇或强调,相当于how ever的用法,其意为“究竟怎样,到底以什么方式”。如:
However did you get here without a car? 没有汽车你究竟是怎样来的呢?
However does he manage to write music when he is so deaf? 他聋成这个样子,究竟是怎样从事作曲的呢?
2、用作连词,引导方式状语从句,表示“无论以何种方式”“不管怎样”。如:
However it may be, I shall take your word. 无论如何,我将会相信你的话。
The painting looks wrong however you look at it. 这张画不论怎么看都显得不对劲。
However you travel, it’ll take you at least two days. 无论你怎么个走法,至少要两天时间。
spend的用法
spend,英文单词,名词、及物动词、不及物动词,作名词时意为“预算”,作及物动词时意为“度过,消磨(时光);花费;浪费;用尽”,作不及物动词时意为“花钱;用尽,耗尽”。下面讲由小编为大家整理了spend的用法相关内容,希望对大家有帮助。
spend的用法
一、take ,spend ,cost, pay的用法都可以表示“花费”,但用法却不尽相同。
spend的主语必须是人, 常用于以下结构:
(1) spend time /money on sth. 在……上花费时间(金钱)。例:I spent two hours on this maths problem. 这道数学题花了我两个小时。
(2) spend time /money (in) doing sth. 花费时间(金钱)做某事。例:They spent two years (in) building this bridge. 造这座桥花了他们两年时间。
(3)spend money for sth. 花钱买……。例:His money was spent for books. 他的钱用来买书了。
二、cost的主语是物或某种活动, 还可以表示“值”, 常见用法如下:
(1)sth. costs (sb.) +金钱,某物花了(某人)多少钱。例:A new com*r costs a lot of money. 买一台新电脑要花一大笔钱。
(2) (doing) sth. costs (sb.) +时间,某物(做某事)花了(某人)多少时间。例:Remembering these new words cost him a lot of time. 他花了大量时间才记住了这些单词。
注意:cost的过去式及过去分词都是cost,并且不能用于被动句。
三、take后面常跟双宾语, 常见用法有以下几种:
(1) It takes sb. +时间+to do sth. 做某事花了某人多少时间。例:It took them three years to build this road. 他们用了三年时间修完了这条路。
(2)doing sth. takes sb. +时间,做某事花了某人多少时间。例:Repairing this car took him the whole afternoon. 他花了一下午修车。
四、pay的.基本用法是:
(1) pay (sb.) money for sth. 付钱(给某人)买……。例:I have to pay them 20 pounds for this room each month. 我每个月要付20英磅的房租。
(2)pay for sth. 付……的钱。例:I have to pay for the book lost. 我不得不赔丢失的书款。
(3)pay for sb. 替某人付钱。例:Don?蒺t worry!Ill pay for you. 别担心, 我会给你付钱的。
(4)pay sb. 付钱给某人。 例: They pay us every month.他们每月给我们报酬。
(5)pay money back 还钱。例:May I borrow 12 yuan from you? Ill pay it back next week. 你能借给我12块钱吗?下周还你。
(6)pay off ones money还清钱。
区别:
take 一般用it做主语,例:it take sb sometime to do sth.
spend 一般是人做主语,例:I spend an hour to finish my homework.
cost表示某物值什么的(价值或钱)例:The bool cost 200yuan.
pay一般是人做主语,例:I pay an hour to do my homework.
mind的用法
英语单词(English words)的产生是汉英两种语言双向交流的产物,一些带有*特色的名称和概念进入了英语词汇,同时还有一些英语词汇进入了汉语,在文化环境中衍生出新的含义,形成了英语词汇的语义文化特征。以下是小编精心整理的mind的用法,欢迎阅读,希望大家能够喜欢。
单词
mind
[英][mand][美][mand]
n.心,精神,心力,知,智力,智慧; 心胸,头脑,人; 愿望,目的,意向,意志,决心,见解,意见; 记忆,记性,记忆力,回想;
vi.介意; 注意;
vt.专心于; 介意; 愿意做; 照顾;
第三人称单数:minds过去分词:minded复数:minds现在进行时:minding过去式:minded
易混淆单词:MindMIND
一、mind作可数名词,意为"脑子;想法;记性".
如:An idea has just come into my mind.
我刚才想到一个主意。
I cant think where Ive left my umbrella; my mind is a complete blank!
我想不起来把伞落哪儿了;一点儿印象都没有!
二、mind作动词
1.意为"当心;注意",后跟名词或从句,也可单独使用。
如:Mind the step!小心台阶!
Now mind!You must hurry home.注意啦!你必须赶快回家。
2.意为"介意;在乎",主要用于疑问句和否定句。
①作不及物动词。
如:Do you mind if I call you later?
我晚一点儿打电话给你好吗?
注意:Do (Would) you mind if...句型用来表示请求对方的许可,即询问对方"是否介意(说话人)做某事"。用Do开头时表示说话人比较直率,故if从句谓语用一般现在时态;用Would开头时则表示说话人语气较为委婉,故if从句谓语用虚拟语气,即一般过去时态。但无论以Do还是以Would开头,其答语相同:
a.如果"同意;不反对"别人做某事,答语用否定形式,也可直接用No,但不普遍。
b.如果"不同意;反对"别人做某事,答语用肯定形式。一般多用I am sorry...或Im afraid...等以缓和语气。
-Do you mind if I smoke?
-Not at all,please.
-Would you mind me opening that door?
-Im sorry,but its not allowed.
②作及物动词,后面通常接名词、代词、V-ing形式、复合结构、从句等。
如:Would you mind my closing the window?
你介意我关上窗户吗?
注意:Do (Would) you mind doing sth.这一句型通常用来表示请他人做某事,常译为"可否请你做。"或"劳驾你做。",多用Would开头,用Do的情况较少.
Would you mind making some room for the patient?
请你给这位病人让点儿地方出来行吗?
其答语与前面的Do (Would) you mind if...句型的答语相同。
mind to do sth.我没见过、没有吧
三、mind的常用短语:
change ones mind 改变主意;
keep...in mind记住。
never mind不要紧
call to mind
回忆起;记起
have a good mind to
非常想…;极有意…
in ones right mind
不疯的;神志清醒的
make up ones mind
决心;决定
put sb.in mind of sb.or sth.
have的用法
英语是一种西日耳曼语支,最早被中世纪的英国使用,并因其广阔的殖民地而成为世界使用面积最广的语言。下面是小编收集整理的have的用法,仅供参考,希望能够帮助到大家。
一、have + 宾语 + 不定式
该结构中have的基本意思是“有”,其主要用法有:
1. 表示有某事要做,其中的'不 定式为定语。如:
She didn’t have the courage to refuse. 她没有勇气拒绝。
Birds have the instinct to learn to fly. 鸟有飞的本能。
We have every reason to think he may still be alive. 我们有充分理由认为他可能还活着。
2. 表示因为有A结果发生了B,其中的不定式为结果状语。如:
I had the luck to find him at home. 我真幸运,找他时他正在家。They had the misfortune to be hit by a violent storm. 他们不幸遇上了猛烈的风暴。
二、have + 宾语 + 动词原形
该结构中的动词原形,实为省略了to的不定式,用作宾语补足语,其中的have为使役动词。该结构的主要用法有:
1. 表示叫(请、使 、让)某人做某事。如:
He had his son clean the car. 他叫他的儿子擦车。
I’ll have the gardener plant some trees. 我要让园丁种些树。
Don’t interrupt her:let her have her say. 别打断她的话,让她把意见说出来。
2. 表示容忍或允许某人做某事(用于否定句,尤与 won’t, can’t连用)。如:
I won’t have you tell me what to do. 我不能让你对我做的 事指手划脚。
三、have + 宾语 + 现在分词
该结构 中的现在分词用作宾语补足语,其中的have为使役动词。该结构的主要用法有:
1. 表示使(让)某人(某事物)一直做在做某事或处于做某事的状态之中。如:
She had her audience listening attentively. 她使听众听得入神
Within minutes he had the whole audience laughing and clapping. 没出几分钟他就让全体听众笑起来,鼓起掌来。
The film had us all sitting on the edges of our seats with excitement. 这部影片让我们大家激动不已。
2. 表示容忍或允许某人做某事(用于否定句,尤与 won’t, can’t连用)。如:
He won’t have boys arriving late. 他不允许孩子们迟到。
I won’t have you smoking at your age. 我不能让你在这个年纪就抽烟。
I hate to have m y boss standing over me. 我不喜欢上司监督我。
3. 说服或命令某人做某事。如:
He had me doing all kinds of jobs for her. 他叫我为她做各种事情。
注:have difficult doing sth是英语中一个很有用的句式,其中的have表示“有”,
We had the greatest diffi culty imaginable getting here in tim e. 我们为了及时赶到此地,经历了可能想见的最大的困难。
四、have + 宾语 + 过去分词
该结构中的过去分词用作宾语补足语,其中的have为使役动词。该结构的最大特点就是,其中的过去分词与其 前的宾语有被动关系。具体说来,该结构有以下主要用法:
1. 表示请(让)别人做某事。如:
We had the machine repaired. 我们请人修理了机器
She’s gone into hospita l to have her appe ndix taken out. 她已住院去切除阑尾。
What beautiful curls — why do you want to have them cut off? 你那鬈发多漂亮啊——为什么要剪掉呢?
注:有时指无意志的行为。如:
He had his salary raised. 他加薪了。
2. 表示经历或遭遇某情况。如:
He had his finger cut. 他的手指弄伤了。
I h ad my w atch stolen yesterday. 我的表昨天被人偷去了。
3. 表示主动地完成某动作或解决某事。如:
I’ve had all my mistak es corrected. 我已把所有的错误都改正过来了。
You should understand the traffic r ule by now. You’ve had it explained often enough 到现在你应该理解这条交通规则了,已经给你解释得够多了。(2005天津卷)
I have had everything prepared beforehand. 我已事先把一切都准备好了。
Paul’s mother had him adopted because she couldn’t look after him herself. 保罗的母亲因为自己无力抚养他,便将他送给别人收养了(
4. 表示容忍或允许做某事(用于否定句,尤与 won’t, can’t 等连用)。如:
We won’t have anything said against the Party. 我们不允 许有人这 样攻击党。
注意,下面一句中的worried可视为形容词,而非过去分词:
afraid的用法
害怕,畏惧(可能受伤害、受苦);担心(会发生某事);担心,生怕(将发生不快、不幸或危险的事)。以下是小编为大家整理的afraid的用法相关内容,仅供参考,希望能够帮助大家!
一、afraid的用法
A. 作表语
1. 不敢[害怕](做某事)的 (unwilling to do something because you are worried about what will happen if you do it.) 相当于frightened。
(1) afraid of sb / sth 害怕某人[物] 例如:
Are you afraid of snakes? (=Are you frightened of snakes? / Do you fear snakes? / Are you scared of snakes? / Are you fearful of snakes?)你怕蛇吗?
I was afraid of the other boys... 我害怕其他的男孩……
(2) afraid of doing sth 害怕做某事 例如:
Hes afraid of going out alone at night. 他害怕夜晚独自出去。
(3) afraid to do sth 害怕(或不敢)做某事 例如:
Im still afraid to sleep in my own bedroom. 我怕仍然不敢再自己的卧室睡觉。
2. 担忧或忧虑(某事物可能产生的后果); 恐怕 (worried or anxious about (the possible result of sth))
(1) afraid of doing sth 担心做某事 例如:
I didnt mention it because I was afraid of upsetting him. (=I didnt mention it because I was afraid (that) I might upset him.) 我没有提起那件事, 因为我怕他心烦意乱。
(2) afraid to do sth 担心做某事 例如:
Don’t be afraid to ask if you don’t understand. 你要是不懂,尽管问好了。
(3) afraid that.... 恐怕…… 例如:
Hes afraid that he might lose customers. (= Hes afraid of losing customers.) 他怕失去顾客。
3. 担心(某事物[某人]会遇到危险) (frightened or worried about things that may put sth / sb in danger)
afraid for sth / sb 担心某人[物] 例如:
They’ve been laying people off, and Charlie is afraid for his job. 他们一直在裁员,所以查理为自己的工作担心。
4. I’m afraid... (礼貌地说出令人不快、失望或感到遗憾的事)我怕,恐怕,很遗憾,对不起 (used as a polite way of telling sb. sth. that is unpleasant or disappointing, or that you are sorry about)
(1) I’m afraid that... (通常省略that) 例如:
Im afraid we cant come. 很抱歉, 我们不能来。
在java中Synchronized的用法
synchronized关键字可以作为函数的修饰符,也可作为函数内的语句,也就是*时说的同步方法和同步语句块。如果再细的分类,synchronized可作用于instance变量、object reference(对象引用)、static函数和class literals(类名称字面常量)身上。下面是小编收集的在java中Synchronized的用法,希望能帮到你。
在进一步阐述之前,我们需要明确几点:
A.无论synchronized关键字加在方法上还是对象上,它取得的锁都是对象,而不是把一段代码或函数当作锁――而且同步方法很可能还会被其他线程的对象访问。
B.每个对象只有一个锁(lock)与之相关联。
C.实现同步是要很大的系统开销作为代价的,甚至可能造成死锁,所以尽量避免无谓的同步控制。
接着来讨论synchronized用到不同地方对代码产生的影响:
假设P1、P2是同一个类的不同对象,这个类中定义了以下几种情况的同步块或同步方法,P1、P2就都可以调用它们。
1. 把synchronized当作函数修饰符时,示例代码如下:
Public synchronized void methodAAA()
{
//….
}
这也就是同步方法,那这时synchronized锁定的是哪个对象呢?它锁定的是调用这个同步方法对象。也就是说,当一个对象P1在不同的线程中执行这个同步方法时,它们之间会形成互斥,达到同步的效果。但是这个对象所属的Class所产生的另一对象P2却可以任意调用这个被加了synchronized关键字的方法。
上边的示例代码等同于如下代码:
public void methodAAA()
{
synchronized (this) // (1)
{
//…..
}
}
(1)处的this指的是什么呢?它指的就是调用这个方法的对象,如P1。可见同步方法实质是将synchronized作用于object reference。――那个拿到了P1对象锁的线程,才可以调用P1的同步方法,而对P2而言,P1这个锁与它毫不相干,程序也可能在这种情形下摆脱同步机制的控制,造成数据混乱。
2.同步块,示例代码如下:
public void method3(SomeObject so)
{
synchronized(so)
{
//…..
}
}
这时,锁就是so这个对象,谁拿到这个锁谁就可以运行它所控制的.那段代码。当有一个明确的对象作为锁时,就可以这样写程序,但当没有明确的对象作为锁,只是想让一段代码同步时,可以创建一个特殊的instance变量(它得是一个对象)来充当锁:
class Foo implements Runnable
{
private byte[] lock = new byte[0]; // 特殊的instance变量
Public void methodA()
{
synchronized(lock) { //… }
}
//…..
}
注:零长度的byte数组对象创建起来将比任何对象都经济――查看编译后的字节码:生成零长度的byte[]对象只需3条操作码,而Object lock = new Object()则需要7行操作码。
3.将synchronized作用于static 函数,示例代码如下:
Class Foo
{
public synchronized static void methodAAA() // 同步的static 函数
{
//….
}
public void methodBBB()
{
关于until的用法
Until用法:表示“直到……为止”,两者常可换用,只是 until 比 till稍正式,所以在正式文体中,一般用 until,而在口语或非正式文体中则两者都可用.从其后所接成分来看,till多与名词或较短的从句连用,而较长较复杂的成分多用 until,位于句首时也多用 until.接下来就由小编带来以下内容,希望对你有所帮助!
连词 conj. 直到…为止
up to the time when
· Ill wait until he arrives and then Ill leave.
我要等他来以后再离开.
· Go straight on untill you come to a large red building.
一直往前,走到一幢高大的红色建筑物为止.
· Lets wait until the rain stops.
咱们等雨停吧.
· The teacher kept on asking the students questions until the bell rang.
老师反复向学生提问,直到下课铃响.
连词 conj. (在否定句中)在…之前
in (in negative constructions) before
· I shant do that until you come back.
在你回来之前,我不会干那件事.
· We wont come to any decision until we have had a chance to discuss the problem thoroughly.
我们有机会充分讨论这个问题再决定下来.
· Until you told me I had no idea of it.
在你告诉我之前,我对此一无所知.
介词 prep. 直到…为止
up to a certain time
· It was only a week until Christmas.
离圣诞节只有一个星期了.
· She will stay until Saturday.
她要一直呆到星期六.
介词 prep. 在…之前;不到…(不)
before
· I cant come until tomorrow.
我得明天才能来.
· Not until noon did it stop raining.
直到中午雨才停止.
· Until then, I knew nothing at all about it.
在那以前,我对此一无所知.
· Until her fathers death, she had always lived in London.
在她父亲去世之前,她一直住在伦敦.
give用法和短语
give的用法和短语
for语句的用法
之的古诗用法
if语句的用法
benefit的用法短语
call的用法及短语
while语句的用法
sql语句in的用法
switch语句的用法
stand的用法及短语
alter语句的用法
control用法短语
confirm的短语及用法
to在句子中的用法
古诗纸的用法
of在句子中的用法
expect的用法及短语
live的用法及短语
ifelse语句的用法
contact的短语及用法
practice的用法短语
THE在句子中的用法
effort的短语及用法
equip的用法及短语
break语句的用法
watch用法与短语
form用法及短语
famous的用法及短语
involve用法及短语