Vikyath Ram has Published 151 Articles

What is the difference between a StringBuffer and StringBuilder in java?

Vikyath Ram

Vikyath Ram

Updated on 25-Feb-2020 12:25:18

210 Views

The StringBuffer and StringBuilder classes are used when there is a necessity to make a lot of modifications to Strings of characters.Unlike Strings, objects of type StringBuffer and String builder can be modified over and over again without leaving behind a lot of new unused objects.The StringBuilder class was introduced as of ... Read More

What does the method int capacity() do in java?

Vikyath Ram

Vikyath Ram

Updated on 25-Feb-2020 10:06:15

197 Views

The capacity() method is used to return the current capacity of a vector. Capacity is the length of the array kept in the vector.Exampleimport java.util.Vector; public class VectorDemo {    public static void main(String[] args) {       Vector vec = new Vector();       vec.add(14);     ... Read More

What does the method empty() do in java?

Vikyath Ram

Vikyath Ram

Updated on 25-Feb-2020 10:00:29

89 Views

The empty() method is used to test if this stack is or not.Exampleimport java.util.*; public class StackDemo {    public static void main(String args[]) {           Stack st = new Stack();       st.push("Java");       st.push("Source");       st.push("code");       ... Read More

How to limit input text length using CSS3?

Vikyath Ram

Vikyath Ram

Updated on 25-Feb-2020 07:28:19

701 Views

With HTML, you can easily limit input length. However, with CSS3, it will not be possible, since CSS can’t be used to limit the number of input characters. This will cause a functional restriction.CSS deals with presentation i.e. how your web page will look. This is done with HTML attribute ... Read More

Does a favicon have to be 32x32 or 16x16?

Vikyath Ram

Vikyath Ram

Updated on 25-Feb-2020 06:44:30

5K+ Views

A favicon is a little icon visible on the web browser tab, just before the page title. It is generally a logo with a smaller size. The size of a favicon is 16x16, since it also gets displayed next to the URL of your site in a browser's address bar.The ... Read More

Member variables vs Local variables in Java

Vikyath Ram

Vikyath Ram

Updated on 24-Feb-2020 05:31:57

1K+ Views

Local VariableLocal variables are declared in methods, constructors, or blocks.Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block.Access modifiers cannot be used for local variables.Local variables are visible only within the declared method, ... Read More

How do you check if a ResultSet is empty or not in JDBC?

Vikyath Ram

Vikyath Ram

Updated on 21-Feb-2020 10:51:41

6K+ Views

Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general).The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).The next() methodThe next() method of ... Read More

How to extract the last n characters from a string using Java?

Vikyath Ram

Vikyath Ram

Updated on 20-Feb-2020 04:47:44

9K+ Views

To extract last n characters, simply print (length-n)th character to nth character using the charAt() method.ExampleLive Demopublic class ExtractingCharactersFromStrings {    public static void main(String args[]) {           String str = "Hi welcome to tutorialspoint";       int n = 5;       int initial = str.length()-5;       for(int i=initial; i

How to count the number characters in a Java string?

Vikyath Ram

Vikyath Ram

Updated on 20-Feb-2020 04:43:25

574 Views

Declare an integer, initialize it with 0, in for loop increment it for each character.ExampleLive Demopublic class Sample {    public static void main(String args[]) {       String str = new String("Hi welcome to Tutorialspoint");       int count = 0;       for(int i = 0; i

How to concatenate two strings using Java?

Vikyath Ram

Vikyath Ram

Updated on 19-Feb-2020 12:50:01

221 Views

You can concatenate two Strings using the concat() method.ExampleLive Demopublic class ConcatinatedStrings {    public static void main(String args[]) {             String str1 = new String("Tutorials");       String str2 = new String( "Point");       String res = str1.concat(str2);       System.out.println(res);    } }OutputTutorialsPoint

Previous 1 ... 5 6 7 8 9 ... 16 Next
Advertisements