Can we use camel case in java package naming? [duplicate] - java

This question already has answers here:
What is the convention for word separator in Java package names?
(6 answers)
Closed 6 years ago.
For example:
Which of the following package names is correct?
com.google.payrolldivision;
or
com.google.payrollDivision;
Please just answer the question without beating around the bush?

Please just answer the question
OK, then taking your question as a "a xor b", the answer is
com.google.payrolldivision;
as per https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html.
However, your title and post ask two very different questions, so it's hard to "just answer the question".

According to the Oracle webpage, you should write your package name in lowercase.
Package names are written in all lower case to avoid conflict with the names of classes or interfaces.

Related

Why should java variable names start with lowercase characters? [duplicate]

This question already has answers here:
camel case method names
(12 answers)
Closed 7 years ago.
I do not understand what the difference between
int Hello ;
and
int hello ;
is .
Does it make a big difference if i use upper case Characters ?
That's because of Java Convention!
Actually, you can write a program like the way you're imagining but, you won't be following any pattern.......If you become a real programmer someday, you'll understand that patterns exist to make things better and easier.....

What do the paired "<" and ">" symbols mean in Java? (For example, ArrayList<String>) [duplicate]

This question already has answers here:
What is the role of the data types inside of < > in Java? [duplicate]
(5 answers)
Closed 8 years ago.
I am familiar with using parentheses, as in myMethod(myParameter), in Java and other programming languages, but what do the lesser than < and greater than > signs mean when they are used together in a array name? Is there a special name for them?
Sorry if this is a duplicate, but I don't know how to search for this.
Clarification: I wasn't referring to the role of any specific type inside the symbols, but rather the usage of the <> symbols themselves.
it is java generics, for type safe, and always.using with collections.
i suggest you read the SCJP book, it has a chapter called Generics and Collections, it provides all details you will need, it really helpful. hope it helps.

Underscore in package name in Java - is it bad? [duplicate]

This question already has answers here:
What is the convention for word separator in Java package names?
(6 answers)
Closed 8 years ago.
Sorry for my English
I think that sometimes it is necessary.
In my opinion search_result_list, location_provider are easier to read than searchresultlist, locationprovider.
What does the documentation say?
Code Conventions could be found here!
I think code conventions are nothing to vary, so stick to such conventions if there exist any...

Java : String representation from Integer [duplicate]

This question already has answers here:
How to convert number to words in java
(31 answers)
Closed 9 years ago.
I'm having a list of Integer from 1 to 100. If I loop through the list, I wanted to make the output as,
"One"
"Two" .....
"Hundred"
Is there any direct method in Java to obtain the above output?
No such method or class has been provided by JDK.
You can use the code mentioned here or here for reference purpose.
switch case are used to meet that requirement: Here
is source code.
Answer of this question described here: How to convert number to words in java
Officially this is not possible or no standard library available by native Java.
Don't duplicate.
There is none in the official Java libraries. However, the International Components for Unicode project has a RuleBasedNumberFormat with those capabilities. It even has a SPELLOUT constant.

Java - Regex problem [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Java - Regex problem
I have list of URLs of types:
http://www.example.com/pk/etc
http://www.example.com/pk/etc/
http://www.example.com/pk/etc/etc
where etc can be anything.
So I want to search only those URLs that contains www.example.com/pk/etc or www.example.com/pk/etc/.
Note: It is for all those who think that it is a duplicate question -- Kindly read both the questions carefully before marking this question as duplicate. Even after reading you can't understand that both the questions are different, then kindly leave without marking it as duplicate because I can't tell you the diff. in anymore detail
String pattern = "http://www.example.com/pk/[^/]+/?$";
I am assuming http://www.example.com/pk// is not accepted. If this should be accepted too, then use
String pattern = "http://www.example.com/pk/[^/]*/?$";
Your problem isn't fully defined so I can't give you an exact answer but this should be a start you can use:
^[^:]+://[^/]+\.com/pk/[^/]+/?$
The difference is that the / is no longer optional and there must be at least one more character after pk/.
These strings will match:
http://www.example.com/pk/ca
http://www.example.com/pk/ca/
https://www.example.com/pk/ca/
These strings won't match:
http://www.example.com/pk//
http://www.example.co.uk/pk/ca
http://www.example.com/pk
http://www.example.com/pk/
http://www.example.com/anthingcangoeshere/pk
http://www.example.com/pkisnotnecessaryhere
http://www.example.com/pk/ca/sf
So I want to search only those URLs that contains www.example.com/pk/etc or www.example.com/pk/etc/.
Update
I think this will work:
https?://.*\\.?[A-Za-z0-9]+\\.com/pk/etc/?[^.]
But every item in the list you gave contains what you are searching for.

Categories