List Inside List Iteration in Java

List: Usually we can iterate a list using iterator or foreach loop. Here we are first iterating the mainlist which holds sublists. And the sublists are iterated and printed the values. Program: package; import java.util.ArrayList; import java.util.List; public class ListInsideListIteration { public static void main(String[] args) { List mainList = new ArrayList(); List mobileCompanies = new ArrayList(); List laptopCompanies […]

345 total views, no views today

» Read more

How to count the number of div using jsoup ?

Counting the number of div: Code block: Elements all_divs = doc.getElementsByTag("div"); System.out.println(all_divs.size()); Output: Gives the total number of div tag present in the webpage. Sample Program: import; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import; public class JavadomainParse { public static void main(String[] args) throws IOException { String url =""; Document doc = Jsoup.connect(url).get(); Elements all_divs = doc.getElementsByTag("div"); System.out.println(all_divs.size()); […]

518 total views, no views today

» Read more

Arraylist iteration in java

Arraylist: Arraylist is used to hold any number of elements. Program: package; import java.util.ArrayList; import java.util.Iterator; public class ArrayListIteration { public static void main(String[] args) { // Arraylist which holds only string. ArrayList<String> al = new ArrayList<String>(); //Adding below companies names to arraylist. al.add("Hp"); al.add("Samsung"); al.add("Dell"); al.add("Apple"); al.add("Compaq"); //Iterator Iterator iter = al.iterator(); //Iterating arraylist using while loop. while(iter.hasNext()){ […]

683 total views, no views today

» Read more

oscommerce installation guide on localhost

What is Oscommerce ? Oscommerce is a another CMS (Content Management System) like wordpress, particularly to create online stores. Oscommerce download link:  Installation guides: Step 1: Download the xampp from Step 2: Open the xampp-control and start the mysql. Step 3: Then open the browser and type “http://localhost” xampp will be opened. Step 4: Click the phpmyadmin to create […]

673 total views, no views today

» Read more

[Solved] the installation cannot be completed fantastico

Install wordpress (2/3) the installation cannot be completed: This error occurs when you try to install the wordpress using fantastico. Why this error coming ? The fantastico thinks that you have already installed the wordpress for the same domain. Possible root causes : 1. You may have index.html file in your public_html folder. 2. You might have uninstalled the wordpress […]

289 total views, no views today

» Read more

How to parse a website in java using jsoup ?

What is Jsoup ? Jsoup is a java library, used to parse and extract content of a website. As well as it can do many things, few things are given below, Parsing any website content using get or post method, Can able to parse any HTML elements, Attributes and text etc….. Download link: Parsing website ( using jsoup: […]

637 total views, no views today

» Read more

Arabic language in jsp example

Arabic in jsp: Encoding should be changed: We need to change the pageEncoding and charset to utf-8 inorder to get the arabic output. If we leave pageEncoding and charset to “ISO-8859-1” then it will not allow to save the arabic content in the jsp page. If we save by force then it will changed to “??????????” like this. So we […]

351 total views, no views today

» Read more

Steps to develop txtweb application

Txtweb development steps: Txtweb is a sms based platform, means that you can get everthing simply messaging to 92665 92665. Format: @kilometre source destination Eg: @kilometre chennai bangalore send the above formatted message to 92665 92665 (No additional charge, but ensure you have put sms pack already) Then it will reply like “Distance: 346 km Time: 5 hours 15 mins”. Step […]

1,082 total views, no views today

» Read more

Difference between ArrayList and Collection

Collection: Collection col = new ArrayList(); Iterator col_iter = col.iterator(); You will not able to get the arraylist value by its index. (col_iter.get(index) method does not exist). Set firstSet = new HashSet(); You can able to assign the col_iter = firstSet; without any casting. ArrayList: ArrayList al = new ArrayList(); Iterator al_iter = al.iterator(); You can access the arraylist value […]

No views yet

» Read more
1 2