SWE1007 JAVA PROGRAMMING
DIGITAL ASSIGNMENT-1
19MIS0123
SUNIL R
BASIC PRACTICE PROGRAMS
1. Predict the output.
Code:
public class Testing
public static void main(String[] args)
// the line below this gives an output
// \u000d System.out.println("comment executed");
OUTPUT:
2. Use doc comments to prepare automatically generated documentation for a user defined
class which has two methods in it. Also include the following tags.
@author
@version
@param
@return
CODE:
import java.io.*;
/**
* <h1>sub Two Numbers!</h1>
* The SUBNum program implements an application that
* simply SUB two given integer numbers and Prints
* the output on the screen.
* @author sunil R
* @version 1.0
* @since 2021-08-12
*/
public class subNum {
/**
* @param numA This is the first paramter to subNum method
* @param numB This is the second parameter to subNum method
* @return int This returns sub of numA and numB.
*/
public int subNum(int numA, int numB) {
return numA - numB;
/**
* This is the main method which makes use of subNum method.
* @param args Unused.
* @return Nothing.
* @exception IOException On input error.
* @see IOException
*/
public static void main(String args[]) throws IOException {
subNum obj = new subNum();
int sub = obj.subNum(10, 20);
System.out.println("sub of 10 and 20 is :" + sub);
OUTPUT:
2. Describe what happens if you try to execute UseArgument with each of the following
command lines:
CODE:
public class UseArugument
public static void main(String[] args)
System.out.print("Hi, ");
System.out.print(args[0]);
System.out.println(".How are you?");
}
a.java UseArgument java:
OUTPUT:
b. java UseArgument @!&^%:
OUTPUT:
C.java UseArgument 1234:
OUTPUT:
d.java UseArgument.java Bob:
OUTPUT:
e. java UseArgument Alice Bob:
OUTPUT: