Posts

Showing posts from July, 2018

How to pass argument in main function of java program using command line argument

Image
How to pass argument in main function of java program using command line       argument  There are only one way to pass argument in main() function of java program and that is using command  line .Here is the step by step procedure of how to pass argument using command line. As main function have a formal parameter i.e., args[] which is array of String type and accepts number of arguments passed during the run time of program through command line. This is  illustration of program to calculate the sum of number passed by user as argument in main function. public class CommandLine {   public static void main(String []args)    { int sum=o;       for(int i=0;i<args.length;i++)     {sum=sum+Integer.parseInt(args[i]); /* Here the argument accepted from command line are added one by one.But there is problem as command line arguments are of String type ,Hence we need to convert them before adding wh...

Online_calculator_using_html,javascript_and_css(source code)

Image
Online_calculator_using_html,javascript_and_css(source code) The source code of online calculator using html,css and javascript is given below. <!DOCTYPE html5> <html>   <head>    <title>Online Calculator</title>    <style>      div{        background-color:#edb;    height:360px;    width:305px;    border:solid gray 2px;    margin:auto;   }   .btn{       cursor:pointer;   margin:2px;   width:67px;   height:45px;   background-color:gray;   font-size:20px;            }    .btn:hover{      font-size:23px;     background-color:#ebb;   }   .clear{     width:295px; font-size:20px; height:45px;margin:5px;cursor:pointer; background-color:gray;   }  ...