CodeGym/కోర్సులు/మాడ్యూల్ 1/IDEAలో డీబగ్గింగ్: వేరియబుల్స్

IDEAలో డీబగ్గింగ్: వేరియబుల్స్

అందుబాటులో ఉంది

1. చూడండి

మీ ప్రోగ్రామ్ యొక్క ఎగ్జిక్యూషన్ బ్రేక్‌పాయింట్‌లో ఆగిపోయినప్పుడు లేదా మీరు ఒక సమయంలో ఒక సూచన ద్వారా అడుగు పెట్టినప్పుడు, మీరు ప్రోగ్రామ్‌లోని ప్రస్తుత ప్రదేశంలో తెలిసిన వేరియబుల్స్ విలువలను చూడవచ్చు.

నుండి 10సంఖ్యలతో -ఎలిమెంట్ శ్రేణిని నింపే ప్రోగ్రామ్‌ను వ్రాద్దాం . ఉదాహరణ:100109

IDEA వేరియబుల్స్‌లో డీబగ్గింగ్

IntelliJ IDEA కోడ్ పైన ఉన్న ముఖ్యమైన వేరియబుల్స్ యొక్క విలువలను ప్రదర్శించడానికి తగినంత స్మార్ట్. మా విషయంలో, మేము dataఅర్రే వేరియబుల్ గురించి మాట్లాడుతున్నాము

అలాగే, స్క్రీన్‌షాట్ దిగువన, మేము డీబగ్గర్ ట్యాబ్ తెరవడాన్ని చూస్తాము ( కన్సోల్ కాదు ). ఇది ప్రోగ్రామ్‌లో ఈ స్థలంలో తెలిసిన అన్ని వేరియబుల్స్ (వాటి విలువలతో పాటు) ప్రదర్శిస్తుంది.

మీరు 10 సార్లు నొక్కితే F8, మీరు లూప్ ద్వారా 5 పునరావృత్తులు చేస్తారు (లూప్ హెడర్ కోసం ఒకటి మరియు లూప్ బాడీ కోసం ఒకటి). అప్పుడు మీరు ఇలాంటి ఫలితాన్ని పొందుతారు:

IDEA వేరియబుల్స్‌లో డీబగ్గింగ్ 2

మేము లూప్ యొక్క పునరావృతాలను పూర్తి చేసాము 5మరియు డేటా శ్రేణి ఇప్పటికే విలువలను 10కలిగి ఉందని మీరు చూడవచ్చు : , , , మరియు .5100101102103104

మార్గం ద్వారా, మీరు శ్రేణిలోని కంటెంట్‌లను కుదిస్తే, మీరు మరికొన్ని ఉపయోగకరమైన వేరియబుల్‌లను చూడవచ్చు:

IDEA వేరియబుల్స్‌లో డీబగ్గింగ్ 3

2. వేరియబుల్స్ విలువలను మార్చడం

మార్గం ద్వారా, వేరియబుల్స్ యొక్క నిర్దిష్ట విలువలను అందించిన మీ ప్రోగ్రామ్ ఎలా ప్రవర్తిస్తుందో మీరు పరీక్షించాలనుకుంటే, ప్రోగ్రామ్ నడుస్తున్నప్పుడు (డీబగ్ మోడ్‌లో) మీరు ఏదైనా వేరియబుల్ విలువను మార్చవచ్చు.

దీన్ని చేయడానికి, వేరియబుల్ పేరుపై కుడి-క్లిక్ చేయండి లేదా నొక్కండి F2:

అప్పుడు వేరియబుల్ యొక్క కొత్త విలువను నమోదు చేసి నొక్కండి Enterమరియు అంతే:

మీరు అన్ని IntelliJ IDEA ఫీచర్లలో గరిష్టంగా 5% నేర్చుకున్నారు. మీరు వీటిని స్వాధీనం చేసుకున్న తర్వాత, మేము మిగిలిన వాటి గురించి మాట్లాడుతాము.


3. కోడ్ స్నిప్పెట్‌ని అమలు చేయడం

మీ ప్రోగ్రామ్ రన్ అవుతున్నప్పుడు మీరు ఏ సమయంలోనైనా ఏకపక్ష కోడ్‌ని కూడా అమలు చేయవచ్చు. ఇది సందర్భ మెనులో Alt+ కీ కలయిక లేదా సంబంధిత అంశాన్ని ఉపయోగించి చేయబడుతుంది :F8

కోడ్ స్నిప్పెట్‌ని అమలు చేస్తోంది

మీరు ఏదైనా కోడ్‌ను వ్రాయగలిగే ప్రత్యేక విండో తెరవబడుతుంది మరియు ప్రోగ్రామ్ యొక్క అమలులో ప్రస్తుత ప్రదేశంలో తెలిసిన ఏవైనా వేరియబుల్స్‌ని ఆ కోడ్ ఉపయోగించవచ్చు!

ప్రోగ్రామ్ దాని పనికి అంతరాయం కలిగించకుండా స్క్రీన్‌పై కొంత వచనాన్ని ప్రదర్శించేలా చేయడానికి మీరు ఏదైనా పద్ధతులను కాల్ చేయవచ్చు! ఉదాహరణ:

కోడ్ 2 యొక్క స్నిప్పెట్‌ని అమలు చేస్తోంది
6
టాస్క్
జావా సింటాక్స్,  స్థాయిపాఠం
లాక్ చేయబడింది
Plan to conquer the world
"First, I'll complete the tasks, then I'm going to make a lot of money. Then I'll take over the world". We found this written in a modest young man's personal journal. Let's imagine he knows exactly when this will happen: we'll use the keyboard to enter a number (the number of years it will take to achieve his goal) and the name of the hopeful conqueror. Then we'll display an interesting phrase.
3
టాస్క్
జావా సింటాక్స్,  స్థాయిపాఠం
లాక్ చేయబడింది
Predictions
Some predictions are quite logical. For example, if you become a real programmer, then you'll have a high salary after a while. You don't have to be Nostradamus to come up with that. Let's code up a program where we indicate a name and two numbers (a salary and a number of years). Then we'll display a phrase: " will receive in years".
1
టాస్క్
జావా సింటాక్స్,  స్థాయిపాఠం
లాక్ చేయబడింది
The humble programmer
Dreams about employment as a programmer can't be contained! This is no surprise: The more tasks you finish, the closer you are to achieving your dreams. Let's take another step forward by tackling a task involving humility. Use the keyboard to enter the name of a person, and then display his or her salary. The details are in the task conditions.
1
టాస్క్
జావా సింటాక్స్,  స్థాయిపాఠం
లాక్ చేయబడింది
Deep and pure love
Among humans, lovers usually form couples. But on some planets, triads are common (For example, Isaac Asimov wrote about them in his novel "The Gods Themselves"). Let's use a program to create a triad. We'll use the keyboard to enter the names of three lovers and then display their intense feelings for each other.
1
టాస్క్
జావా సింటాక్స్,  స్థాయిపాఠం
లాక్ చేయబడింది
More conversions
Let's calculate the number of full feet in a certain number of inches. We'll create a special method (getFeetFromInches) to do this. Any remainder should be rounded. Thus, if we pass 243 inches to our method, then we will get only 20 feet, not 20.25.
3
టాస్క్
జావా సింటాక్స్,  స్థాయిపాఠం
లాక్ చేయబడింది
Don't think about seconds…
If you stare at the second hand for a long time, you can feel how quickly and irretrievably time is slipping away.. Enough gawking at the second hand. Instead, let's figure out a task involving seconds.
వ్యాఖ్యలు
  • జనాదరణ పొందినది
  • కొత్తది
  • పాతది
వ్యాఖ్యానించడానికి మీరు తప్పనిసరిగా సైన్ ఇన్ చేసి ఉండాలి
ఈ పేజీకి ఇంకా ఎలాంటి వ్యాఖ్యలు లేవు