Varuna Seneviratna

Ranch Hand
+ Follow
since Jan 15, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
20
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Varuna Seneviratna

Campbell Ritchie wrote:Try "\\s+" to split on whitespace (any positive number of characters).



I think by a 0-length String you mean a String without even a space. As this example illustrates . Do you, by a 0-length String, mean a String type but with no space, whitespace or any other character. It is not practically possible to have a 0-length String within a String

In the example "KRE 2017 1 3 0 34 27 2017.005544 424.306 424.28 0 1 N 172 10 2954 F", between 424.28 and 0, there is a space. If there is an 0-length String, How can a space be displayed?

What is meant by "any positive number of characters"? Does an 0-length string fall to the category of "any positive number of characters"





Why doesn't the output of the above example, provided that the "\\s" splits on any positive number of characters, be the same as in the following example. (Why aren't the delimiters displayed in the output of the above)

4 months ago
Actually what happens when splitting  If you split using  then the result is .

When is split using the result is . In first occurrence of "o" the string is split between "b" and "o:and:foo" then when "o" is encountered for the second time "b" and "o:and:foo" is built into {b", "", ":and:foo} .

Why does an empty string gets constructed?
5 months ago
The documentation at https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String) illustrate six examples. From the six examples, how could the sixth example be explained. Why does a space " " come as part of the result. If two equal characters are placed adjecently, then a space comes as a part of the result(array). How to explain this splitting?

The string "boo:and:foo", for example, yields the following results with these parameters:

Regex Limit Result
: 2 { "boo", "and:foo" }
: 5 { "boo", "and", "foo" }
: -2 { "boo", "and", "foo" }
o 5 { "b", "", ":and:f", "", "" }
o -2 { "b", "", ":and:f", "", "" }
o 0 { "b", "", ":and:f" }

5 months ago
Using documentation how can this be understood? By looking at the documentation at https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html#close-, How could this be understood?
5 months ago
Why nextLine() results in a nosuchelementexception when two pipes to System.in are opened and then if one is closed?

5 months ago
After creating a project using mavan-archetype-webapp category
Java SE and Java EE categories have vanished from Netbeans new project
dialog box. How to get Java SE and Java EE categories back into the
new project dialog box. Screenshot attached.

Please Note : When creating the project the tutorial at https://blog.payara.fish/adding-payara-server-to-netbeans was followed.
1 year ago
Isn't still a statement, even though was changed to
1 year ago

Varuna Seneviratna wrote:If n on the right side in n = n/5 is changed to another variable name no error is given and for another case

public class Emp{
     LocalDate birthDay = LocalDate.of(2019, 3, 10) // This also doesn't give an error

}



Not n on the right side, it is the n on the left side(LHS)
1 year ago
If n on the right side in n = n/5 is changed to another variable name no error is given and for another case

public class Emp{
     LocalDate birthDay = LocalDate.of(2019, 3, 10) // This also doesn't give an error

}
1 year ago
Why inside a class, outside a method a variable when subjected to an action generates an error? For example



The above, when compiled,  generates the below error. This is the case with Strings and other data types. Some type of error is displayed when compiled



1 year ago
Why aren't the posts in the Eclipse forum are not being answered? I have submitted the following two posts but no answers have come in?

https://coderanch.com/t/706102/eclipse/ide/Eclipse-jres

https://coderanch.com/t/706214/eclipse/ide/Eclipse-asks-create-module
2 years ago
When the project name is entered and the Create button pressed, Eclipse issues a dialogue box that has the title "Create module-info.java" and an input box named Module Name with the project name already entered in the input box. The message from the dialogue box says "Discouraged module name. By convention, module names usually, start with a lower case letter". Why does Eclipse 2018-12 ask this question?.
2 years ago
This post is added because the first sentence was not complete in the above post

When the JDK 11 root directory is selected using the search button at Windows -->Preferences--Java--Installed JREs, Eclipse says "No JREs found".But JDK 11 can be added to the list of installed JREs by using the Add button. I would like to know what this means?
2 years ago
If you come into Javaranch using the name javaranch.com and try to log in, An error message is displayed with the following details.


When I try to log in I get the message "An error has occurred." in the page at

https://coderanch.com/forums

. The page further says "most of the time people get this message it is because your browser has gone wonky and is trying to do silly things. Please try restarting your browser or trying a different browser to see if the problem persists. If you are still having problems, please contact us with what you were doing when the error occurred along with the date and time (Feb 10, 2019 5:53:17 PM).

You can also email us at moosesaloon AT javaranch DOT com"


But I am able to post and go through the forums by going to the home page
2 years ago