This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Created by IntelliJ IDEA. | |
* Author: Nikhil Raj Singh | |
* Date: 1/08/20 | |
* Time: 8:10 pm | |
* File: Lab4Task.java | |
*/ | |
package course.lab.labTasks.lab4; | |
import java.util.Scanner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Created by IntelliJ IDEA. | |
* Author: Nikhil Raj Singh | |
* Date: 27/07/20 | |
* Time: 8:42 pm | |
* File: Lab3Task.java | |
*/ | |
import java.util.Scanner; | |
public class Lab3Task { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: Nikhil Raj Singh | |
* Section: K | |
*/ | |
public class Task2 { | |
void computerShop(){ | |
var noOfVarietyOFBrand=(byte)9; | |
var noOfProductSold=(short)545; | |
var BestProductId=343284; | |
var barCode=(long)3232343; | |
var discountPercent=(float)4.43; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: Nikhil Raj Singh | |
* Section: K | |
*/ | |
public class Task1 { | |
void dataTypeInfo() { | |
System.out.printf("%s %s %s %s\n", "Datatype", "Size in bits", "Size in bytes", "Range"); | |
System.out.printf(" %s %d %d %s\n", "byte", Byte.SIZE, Byte.SIZE / 8, "From" + Byte.MIN_VALUE + "to" + Byte.MAX_VALUE); | |
System.out.printf(" %s %d %d %s\n", "short", Short.SIZE, Short.SIZE / 8, "From" + Short.MIN_VALUE + "to" + Short.MAX_VALUE); | |
System.out.printf(" %s %d %d %s\n","int",Integer.SIZE,Integer.SIZE/8,"From"+Integer.MIN_VALUE+"to"+Integer.MAX_VALUE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//created by Nikhil Raj Singh | |
//section K | |
// task 1-Create a "Hello,World!" program in Java | |
class HelloWorld{ | |
void task1(){ | |
System.out.println("Hello,World! "); | |
} | |
} | |
class Run{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//created by Nikhil Raj Singh | |
//section K | |
//Task 2 - Create a program in Java to declare, initialize and use local variables of all the primitive data types in Java. | |
public class DataTypes { | |
byte Byte; short Short;int Int;long Long;float Float;double Double; char Character;boolean Boolean; | |
void integerType(){ | |
Byte = 1; | |
Short = 12; | |
Int = -23; |