Java Quiz: Why StringBuilder Should be Used Instead of StringBuffer?August 23rd, 2008 First tell me what is the best way to concatenate large number of String objects? Is it a + b?
Most Java developers know not to use a + b (+ operator) because of huge performance problems, they use StringBuffer instead. In fact I did some tests in the past which confirms this folklore.
Simplifying Java Software Development: How to Count the Number of Words in a String using Java (one-liner)June 18th, 2005 Java is a language of choice for millions of developers worldwide. In a series of articles I will show simple tips and techniques which make Java extremely powerful and yet simple to use.
JDK1.5 - More painful bugs aka Enumeration-Woes: Solved!August 29th, 2004 Current Status: Solved
Defect:
When more than one annotation type files are compiled in javac(any of the ways like *.java or @srclist or FileName1.java FileName2.java)
then it emits and error message that it cannot find symbol for statically imported Enums. However statically importing one level up and de-referencing works.
Understanding Varargs in Java: 2 Minute Guide For Non-DummiesApril 30th, 2006 Varargs allows variable number of arguments in methods and constructors. Let's start with a simple example.
Java Program: Compare two text filesApril 29th, 2009 Today while managing the comments, I got a request of this sort. HI,
I have a small question in java.
How To Debug Execution Path in PHP...Equivalent of printStackTrace() in JavaMarch 1st, 2007 While programming in PHP often you will find that a simple echo or log statement is not sufficient. You have found out where a problem is happening but you have no clue why it is executing that code in the first place.
How To Compare Strings With == in JavaFebruary 25th, 2006 Almost every java developer finds one fine morning that he cannot compare String with "==" as he has been doing with int or char. Then either he finds out or someone kindly tells him that objects cannot be compared with "==".
HSQLDB Tip: Case Insensitive LIKE Query in HSQLDB RDBMS & Space Crunched String ComparisonJuly 21st, 2007 I previously discussed how to extend HSQLDB relational database with simple Java functions. The example there actually implements case insensitive like query functionality for HSQLDB.
Java Software Programming Examples For Beginners / Interview: How To Swap Integer (and String) Variables Without Using a Temporary VariableOctober 29th, 2005 A Simple Programming Question for Beginners
Discussion & Examples: Java enums versus public static finalSeptember 23rd, 2008 Should we use to represent a constant String such as browser's user agent or simply use public static final String as before?
Using public static final as enum has many problems, such as:
Not typesafe - Since a type is just an int you can pass in any other int value where a particular type is required, or add two types together (which makes no sense). This is particularly noticeable in C programs where you will find strange constants being used in un-related place and yet it seems to work, simply because the required constant and the provided constant share the same int value.
Java EE 5 is Not Your Father's J2EEApril 10th, 2006 Java Platform Enterprise Edition (Java EE, formerly referred to as J2EE) Version 5 has arrived. Its streamlined features offer added convenience, improved performance, and reduced development time, all of which enable developers to bring products to market faster.
How To Split Java String By NewlinesJuly 19th, 2007 Splitting a String by newline is a common requirement. When processing textual data from files or from web we need to split the data by newline boundaries.
Tip: How To Extend HSQLDB RDBMS With Java FunctionsJuly 17th, 2007 HSQLDB is an unique high performing, high quality Java based relational database which can be very easily extended with simple Java static functions. Here we will see how you can easily extend the database capability with a real-life example.
Apache Ant: How To Set Property When Initially UnsetAugust 19th, 2008 Also: How To Flexibly Pass JVM parameters to Apache Ant Java (Runtime) Task
Apache Ant is an excellent Java based build & deployment system using XML configuration file. In Ant properties are extensively used to configure tasks, conditionally run targets and more.
Java Software: 1-Line Sort & Uniq UtilityOctober 18th, 2005 I had to sort and uniq (create a unique set of strings) a large list with lots of duplicate. My options were to write it in Java or download cygwin and run: cat file | sort | uniq > result
Cygwin download never works for me.
November 11th, 2005 at 11:12 am
So you saying that you should always use “int byteCount = myString.getBytes().length;” instead of “myString.length()”, just in case you Internationalize later?
August 30th, 2007 at 1:26 am
Is there an example for this.
August 30th, 2007 at 3:12 am
Yes, Jason.
August 30th, 2007 at 3:13 am
I gave the example code in the article. What other examples are you looking for?
October 1st, 2007 at 3:41 pm
Is there a way to filter out the punctuation similar to setting delimiters to where the program only counts the letters?
April 1st, 2008 at 11:13 pm
how can i find a length of string with out using any function in java.. plz help me..
April 10th, 2009 at 2:19 pm
Hi,
can i have the code for finding the length of the string without using any string fuctions in java.