I have Java final test tomorrow it is my first time learning and I don't know when to use some code or how to use it ?
I have prepared the questions that I don't know can you answer them please

1-how can I know that I need an array?
2-when to use charAt and how to use it ?
3-what is stub mean and why sometime they ask to have stub ?
4-when to use only condition in for loop?(e.g: for( ; i<10 ;)
5-what is the different between " " and ' ' ? in one of the example they used if (c =='p') why didn't we use if(c == "p")
6- when to use == and .equal
7-how to use boolean? can you give me simple example.
8-how to join 2 string?
7-when to use split?

Recommended Answers

All 5 Replies

you better study for the final you'll have the next week as you might prepare better for it if you invest tonight's time on it. Java - next time.

sorry there is mistake in number 4

4-when to use only condition in for loop?(e.g: for( empty; i<10 ;empty)


please answer my question it really argent my final is tomorrow

if your final is tomorrow, you should have understood this by now.
all your questions are very, VERY, basic knowledge.
I have no doubt you can find the answers to all of them in your cours notes.
if you are taking a course which takes more than 1 hour a week for half a year, take a closer look at the first chapters then.

you have for and while loops. you use for loops when you know the exact number of iterations you need. that is, when you have a definite number of iterations to go through. but you use while loops when the number of iterations you will go through is indefinite.

5.things between double quotes are strings. things between single quotes are characters.

5. you use .equals when you compare objects, == otherwise (literal values). Strings are objects, so you use .equals when comparing strings... and so on. read your book friend.

Member Avatar for hfx642

Most of your question can be answered by when YOU need them (but, don't write that as your answer).
What these "things" are for will be in your notes/book.
With the exception of #3, all of your questions are basic.

A "stub" is a "do nothing" method.
It provides the ability to make a method call without your application failing.
It may be a void method, or return a consistant false value. Like... return 0;
You can think of it as a... I'll code that method later.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.