# 0.2 Learning objects for methods in java  (Page 3/6)

 Page 3 / 6
• The main method calls the method printMax ; the actual parameters are two integer literals.
• The activation record for printMax is allocated, and the actual parameters are used to initialize the formal parameters a and b .
• The variable max is allocated but not initialized.
• The method maximum is called; the actual parameters are the values of a and b , which are the formal variables of method printMax .
• An activation record is allocated for maximum . (There are now three activation in the stack.) The new activation record includesmemory for the formal parameters a and b ; note that these are new parameters not at all related to the formal parameters of the same namesin the previous method printMax because those parameters are hidden.
• The method maximum executes its body and returns a value. Just before it returns, select the tab Call Tree above the graphic display; the sequence of calls from main to printMax and then maximum is displayed. Select Theater to return to the animated display.
• When the method returns, its activation record is deallocated, uncovering the activation record of printMax .
• The value returned is assigned to the variable max and printed.
• When printMax completes its execution, its activation record is deallocated.

Note: In a call to a static method, the name of the class in which it is defined can be given as in the call to maximum . Since the method is defined in the same class as the call,the class name need not be given, as shown in the call to printMax .

Exercise Write a program to compute the maximum of six values using as few statements as possible.

## Recursion

Concept Recursion occurs when method calls itself. There is nothing at all mysterious about recursion!Each call simply creates a new activation record on the stack. However, to ensure that the recursive calls terminate,eventually, some call of the method should return without invoking itself once again.

Program: Method04.java

// Learning Object Method04 //    recursionpublic class Method04 {     static int factorial (int n) {        if (n <= 1)             return 1;        else             return n * factorial(n-1);    }      public static void main(/*String[] args*/) {        System.out.println(factorial(5));     }}

The standard example of a recursive method is one that computes the factorial function:

$n!=n·\left(n-1\right)·\cdots ·2·1=n·\left(n-1\right)!$

The recursion is terminated by defining $n!=1$ for $n\le 1$ .

• The main method calls the method factorial with the actual parameter 5. This creates an activation record with the formal parameter n initialized to 5.
• To compute the expression in the second return statement, the method factorial is called again, this time with the actual parameter equal to $5-1=4$ .
• The sequence of recursive calls continues five times, each one allocating a new activation record with a new variable n .
• Finally, factorial is called with actual parameter 1. This call creates a new activation record as usual, but does notcause factorial to be invoked again. Instead, the value 1 is returned and the activation record is deallocated.Just before the method returns, select the tab Call Tree above the graphic display; the sequence of calls from main to the sequence of recursive calls is displayed. Select Theater to return to the animated display.
• The recursive sequence unfolds : each returned value is used to compute a new value to be returned by that call of factorial .
• Finally, the value 120 is returned to the main method and printed.

#### Questions & Answers

Hi, I have a question. What factors influence social facilitation and social inhibition in groups?
Amritpal Reply
it really depends on that person on how the can task in life either they can work better with other people or you do worse working with people.
Lametra
the task
Lametra
they task
Lametra
Do you know of any studies done to show social facilitation and social inhibition
Amritpal
social facilitation is often influenced by the person's perception of the situation and their appraisal of the task. for example, a track athlete who views their competition as a challenge rather than a threat, will tend to run the fastest they have ever ran under a large crowd.
fady
Another condition is if the person has mastered the ability to perform that task. A track athlete who trains everyday, will perform above average under a large crowd, however, someone who does not run, will tend to do worse than their actual ability under a large crowd
fady
social inhibition can be explained through evolutionary biology or attachment personality theory. some people develop an avoidance personality trait, which when they feel under pressure, they tend to leave the group or avoid a gathering due to high lev of stress
fady
Does anyone know how I can transfer my higher national diploma credits in usa?
Qwanta Reply
Oh wow. I never realised there was a chat on this app!
Amritpal Reply
Then welcome dearest
Bridget
Thank you! ❤️
Amritpal
thank you
Ana
Hello Ana, good afternoon from here
Philip Reply
hello im new student here.
Junalyn Reply
o sorry madm
Rai
hello
Rai
I m also student.
Rai
hi
Kavya
what is easier option to psychology?
Dhanaraj
I'm new too
Deniz
As in the the specialisation or ?
Bridget
good morning
Ana
understanding human nature is what we are going to talk about.
Ana
okay, go ahead
Philip
“ Every child is left to evaluate his experiences for himself, and to take care of his own personal development outside the classroom. There is no tradition for the acquisition of a true knowledge of the human psyche. The science of human nature thus finds itself today in the position that chemis
Ana
well, I think every individual is different and to a great extent we can't say confidently that we understand the human nature in its entirety
Philip
lack determines what we will become in life?.
Ana
Not 100% but it plays a huge role
Philip
Hi! I wasn't aware there was a chat feature on this app 😊
Ophelia
👍Philip Anyaegbu
Ana
cool
Ana
👍
Ana
yes Ana I'm here
Philip
alternatively we are different, we have basic similar qualities
Bridget
Yes true Bridget.
Philip
hello there
Ciel
Hi
Philip
hi
Ej
hi
KUNDAN
hi
Ana
who we are how we think what we do insight
Ana
@ bridget. yes that's true
Ana
Ana ioanidis? do you speak Greek?
Qwanta
Qwanta no I dont speak Greek my husband does
Ana
are you a psychologist? or your husband?
Qwanta
I need some reliable informations about my studies...
Qwanta
not a psychologist
Ana
I ask questions
Ana
so what is the cause why a person experiences a psychological disorder if it not of their own?
Junalyn Reply
it's partly genetics,culture, environment and substance abuse. generally these are the common factors which can lead to most of the disorders
war
waoo
Rai
r u proficcer
Rai
u r psychology subject
Rai
not a professor but a clinical psychologist
war
can i ask you, i keep getting headache, and had a history of hypothyroid ans diagnosed as having mild anxiety disorder. i want to finish. my undergraduate psychology thesis.. but always unable to have good ambition and energy to focus on writing the case and the theories... whats the best remedy
Astaroxche
had a headache and have a history
Ana
297 according to the DSM 5
fady
how many disorders are there
Janareon Reply
interesting question
Mahmoud
it is😅
Nelly
I'm guessing it's in the tens of thousands, maybe hundreds if you include counter interactions and stuff like it. although I'm sure it's almost impossible to know for sure, unless you're very rich and connected to the right people. but as I said: guessing.
Beenie
There are more than 200 classified forms of mental illness. Some of the more common disorders are: clinical depression, bipolar disorder, dementia, schizophrenia and anxiety disorders. Symptoms may include changes in mood, personality, personal habits and/or social withdrawal. that is what I think
Mahmoud
too difficult to number. diagnosing a disorder is just checking off boxes on a compilation of symptoms that might match any particular condition on the DSM
what is psychology of the guest
Lirilong Reply
I don't understand the question can you elaborate?
Edgar
the study of philosophy gives to the sociologist
Aman Reply
why women are viewed as far more emotional than men?
Wario Reply
because they actually are ,I guess.
Collins
May be they are biologically milder than man. It does not mean they are not equal with man. Man can also be emotional and can are oppressed with traditional norms. For example, man are not to be cry, in actual man are also emotional being and they cannot have the right to show their sentiment.
shine
sollungal bro sollungal...
Balaji
because of she has hormonal fluctuations than men..
bavi
usually women are more emotional than men and they are multi talented people
lavanya
Both men and women are capable of expressing emotions. But women has the highest percentage of doing that. Because our society is conditioned by nature in such a way that men are expected to suppress their emotions and motivate them through their acts or thoughts, which has it's side effects of....
Santos
denial of any emotion which they feel that useless at that point. Women in the other hand were encouraged/not controlled to suppress their emotions and let them out what they feel about it. I feel that's the wonderful superpower of the women.
Santos
y
Mahmoud
Men's emotion comes mostly with memories triggered by senses. That means, they thoughts have the power to decide whether to let go of emotions or not.
Santos
Q
Mark
because women tend to be more agreeable than men.
Edgar
women at a young age are conditioned to be more in tune with emotion than man should be less
David
The question is "Why women Viewed are as far more emotional than men ?" it's not a question whether women are more emotional than men. This is more an issue about the point of view from the observer, his/her assumption what emotional behavior is or what emotional behavior is.
Mehmet
The anwers are answers more to the question " Are women more emotional than men?"
Mehmet
hi are you on what'sap
Wunuji Reply
no not really a fan of social laziness
Robert
huh
Parmizan
is there any way for a Btech E.C.E. graduate to take on MSC. PSYCHOLOGY
devesh
ya you can just by cracking entrance , if in India
Mansi
Any stream in UG can go for M.Sc (Psychology)
classification of traits and how they are measured
chinedu Reply
what was Freud's first name?
Robin Reply
Sigmund
Dentriodite
sigmund
Margie
Sigismund Schlomo Freud
Mohammad
Sigmund Freud
Talal
sigmund
Ankita
Leon Vygotsky and Sergei Rubenstein please tell me contributions of these personalities in in 4 lines
Uzma
sigmund Freud
Harpreet
Lev Vygotsky was the founder of socio-cultural theory
Jo
So psychology was based off of the Greek gods I that right or no?
Tanya Reply
psychology is the study. anything -ology is the study of a certain field. Psyche is a mortal woman who becomes divine in Greek mythology. The etymology of the word "psyche" in Greek means "spirit" or "soul"
seriously there is no scope of psychology all over the world.i hear those how have psychology degrees they have no careers
Madeeha Reply
psychology degree is the waste of time qnd waste of money.is this true?...
Madeeha
at least you know people's minds
Mahmoud
hummmmm
Blaq
well, i like this subject for helping myself and others as well, not for the scope or anything. and i think we shouldn't liberate everything on the basis of outcomes etc
Natasha
Ye
Isaiah
very useful skill
Isaiah
It is not at all true that people who have psychology degree have no career scope
Aaprajita
If u complete your M.Phil then you can work in hospitals as a clinical psychologist.You can also work in school, colleges and IT companies as a counsellor or clinical psychologist.
Aaprajita
yes
aravinth
people are so stressful and tense, and they need a psychologist
aravinth
yo fr tbh lol
Isaiah
if some one have only master degree in psychology what will he/she do...where he/she utilizes degree
Madeeha
Not if you have set goals and a plan. Look into what careers are available with your degree where you live. Also it helps to have a specialty along with your psychology degree. For example a Bachelor's degree in Psychology of Science in Addictions allows for you to become an addictions counselor.
Jo
Psychology is really a valuable degree. I would like to become an "EDUCATIONAL PSYCHOLOGIST "
there is no proper society of Psychology. so it doesn't get a good exposure in our country. we along with whole student need to discuss and approach to government
Shekhar
Psychology is not only a diverse field but also one that is expected to grow tremendously in the years to come. As a subject dealing with the study of the human psyche or mind, psychology finds applications across all avenues of life, be it family, work, relationships, sports, corporate spaces
Clinical Psychology As is suggestive, this branch of psychology is associated to the understanding, diagnosis and treatment of psychological disorders in humans. Clinical psychologists help people facing difficulties in their life to get through it using different treatment methods and therapies.
These professionals work with hospitals, NGOs and even drug rehabilitation centers. As people become increasingly aware of different psychological disorders with time, the need for experts in clinical psychology is only expected to grow.
Counseling Psychology Counseling psychology is a branch of psychology that helps solve people’s personal and interpersonal issues. These issues can be problematic but are different from serious mental health issues. Counseling psychologists or counselors help people deal with such issues when they
fail to do it on their own.Career counseling, guidance counseling, marital counseling and rehabilitation counseling are among the many applications of counseling psychology. These professionals either manage their own counseling set-ups or work with therapycenters, career centers, NGOs as well as
schools and universities. Industrial or Organizational Psychology Organizational psychologists are professionals who apply the principles of psychology in organizations or workplaces. They analyze the issues of the workplace at individual as well as organizational level, and work towards resolving
them to enhance the efficiency of the employees. Those specializing in organizational psychology can choose to work as – • Human resource development specialists • HR managers • Organizational consultants With increasing pressure and stress levels at work places, the need for emotional understandi
understanding and gauging social intelligence has become stronger. Child Psychology (Development psychology) Development psychology is a branch of psychology that is dedicated to studying the psychological development of human beings over the course of their lifetime. Child psychology is one of
the more popular variants of development psychology, and deals with emotional, cognitive, social and psychomotor development in infants and children. Child psychologists work with schools, child therapy centers and also NGOs. They also play big roles in special education centers for children.
Sports Psychology This branch of psychology deals with the study of elements that influence an athlete’s performance. These elements or factors could be emotional, cognitive, psychological or motivational. Sports psychologists can go on to work with sports coaching centers, leagues, academies or
sports teams. Sports psychologists aid sportspersons to stay in their best mental forms, thus improving their performances on the ground. With the frenzy regarding sports in India, sports psychology is a promising career to pursue.
Forensic Psychology Forensic psychology offers a unique opportunity to apply psychology to the benefit of legal organizations, especially pertaining to specific contents or witness testimony. Professionals in this field utilize their skills to look deep into the psyche of criminals and figure out
the intent behind the crime. This helps define the quantum and nature of sentence to be rendered. With the onset of new legal era, forensic psychology is expected to influence policy making.
SO,THESE ARE THE CAREER SCOPE IN THE FIELD OF PSYCHOLOGY👥
psychology and the jobs in psychology are the ever growing fields. there are number of jobs available. but, yes, one needs the right qualification, such as, MPhil, PhD, NET, etc.
Paul
No. Psychology has a great scope all over world
Talal
Because of 90% people has stress or anxiety or any other mental problem. So they have a need of Psychologist.
Talal
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

### Read also:

#### Get the best Algebra and trigonometry course in your pocket!

Source:  OpenStax, Learning objects for java (with jeliot). OpenStax CNX. Dec 28, 2009 Download for free at http://cnx.org/content/col10915/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Learning objects for java (with jeliot)' conversation and receive update notifications?

 By By By By Mistry Bhavesh By By By