JAVA


29

Mar 2016

Draw Canvas Using JavaScript

All drawing on the HTML canvas must be done with JavaScript. Here we show a canvas whose some portion fill by orange color. Source Code :  <!DOCTYPE html> <html> <body> <canvas id=”myCanvas” width=”200″ height=”100″ style=”border:1px solid #c3c3c3;”> Your browser does not support the canvas element. </canvas> <script> var canvas = document.getElementById(“myCanvas”); var ctx = canvas.getContext(“2d”); ctx.fillStyle = “orange”; ctx.fillRect(0,0,100,65); </script> </body> </html>   Output:


15

Aug 2015

A Simple way to Generate Random number in Java

Math.Random class In Java Programming, Math.Randoms class generates random integers, doubles, longs and so on, in various ranges. To generate a series of random numbers as a unit, you need to use a single Random object – do not create a new Random object for each new random number. Following example shows this: import java.util.Random; /** Generate 10 random integers in the range 0..99. */ public class RandomInteger  { public static final void main(String… aArgs) { log(“Generating 10 random integers in range...

Read More


15

Aug 2015

Database Connectivity using Type I – JDBC Driver in Java(J2SE)

What is JDBC? JDBC(Java DataBase Connectivity) is used for connecting to different database by which user can shift from one database to another database very easily in platform independent manner. JDBC contains set of functions & specification in the form of packages i.e.: java.sql.*–Core SQL Package javax.sql.*–Extended SQL Package JDBC Driver act like an interface between front end application and back end database. There are four types of JDBC Driver Type...

Read More