Servlet to accept name from user and display it
This is a basic servlet that accepts text from a user through a HTML form and display it. Firstly, the HTML code: <html> <head> <title></title> <meta...
View ArticleProgram to determine if a number is an Armstrong (Narcissistic) number.
An Armstrong number is a number whose sum of the cube of its digits is equal to the number itself. For example: 153 is an Armstrong/Narcissistic number. 153 = 13 + 53 + 33 Similarly, 370 = 33 + 73 …...
View ArticleProgram to find 10001st prime number (Project Euler- Problem 7)
This java program is the solution to Project Euler’s problem-7. It can be found here The problem: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. …...
View ArticleProgram to calculate the sum of all the primes below two million. (Project...
This program is the solution to Project Euler – Problem 10 which can be found here. The Problem: The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all … Continue reading →
View ArticleSolution to Project Euler Problem 16
This program is the solution to Project Euler’s Problem 16. It can be found here. The problem says: The program uses the BigInteger class to deal with large numbers. The answer comes out to be 1366...
View ArticleExecuting a java program without main()
This question is asked by many interviewers during the technical interview. So, the question is self-explanatory. We have to execute a java program without using public static void main(String args[])...
View ArticleIntroduction to Socket Programming
OK so this post is going to be on Socket Programming in Java. A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so...
View ArticleStarting with Android App Development
Quick Tutorial on setting up your PC for developing Android Apps Things you will need: Java Development Kit (JDK) Eclipse IDE Android SDK ADT for Eclipse Step 1: JDK Visit this link: Java SE Downloads...
View ArticleJava Data Mining: Number of occurrences of a word in a file
This is a simple application of Data Mining with the help of Java. We’re calculating the number of occurrences of a specified word in a specified file. We’ve used the class FileInputStream to stream...
View ArticleRank Pages in a Directory by Occurrence of a Particular Word in them – Java...
This is an example of Data Mining with the help of Java. We’re calculating the number of occurrences of a specified word in all the files in a specified folder, and then ranking them accordingly. We’ve...
View ArticleFacebook Hacker Cup : Studious Student Problem Solution in Java
This program is a solution to Studious Student problem from Facebook Hacker Cup. The problem can be found here: link. The problem: Studious Student You’ve been given a list of words to study and...
View ArticleFacebook Hacker Cup : “Double Squares” Solution in Java
This program is a solution to Studious Student problem from Facebook Hacker Cup. The problem can be found here: link. The problem: A double-square number is an integer X which can be expressed as the...
View ArticleProgram to find a square of a number without using multiplication or exponential
I found this question while surfing through the internet. The task is to write a function that accepts a number n and returns the square of n. However, we are not allowed to use the multiplication or...
View ArticleCode jam Store Credit solution in java
I found this question at codejam. You can find the problem here. So lets get onto the problem. Problem You receive a credit C at a local store and would like to buy two items. You first walk through...
View ArticleCode jam “Minimum Scalar product” solution in java
This question was asked in Round 1 of Code Jam 2008 contest. The problem You are given two vectors v1=(x1,x2,…,xn) and v2=(y1,y2,…,yn). The scalar product of these vectors is a single number,...
View ArticleCode jam “Tic-Tac-Toe-Tomek” solution in java
This is the solution to “Tic-Tac-Toe-Tomek” problem of the Code Jam 2013 competition. Problem details: Tic-Tac-Toe-Tomek is a game played on a 4 x 4 square board. The board starts empty, except that a...
View ArticleNetbeans Tutorial – Cookies
The following video demonstrates on using Cookies in Java Servlets using Netbeans IDE
View Article