Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View nikhilrajsingh's full-sized avatar

Nikhil Raj Singh nikhilrajsingh

View GitHub Profile
/* 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;
/* 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 {
/* 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;
/* 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);
@nikhilrajsingh
nikhilrajsingh / gist:8b1ca909fcfd6cf2b38359113a003125
Created July 20, 2020 14:53
task 1-Create a "Hello,World!" program in Java
//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{
@nikhilrajsingh
nikhilrajsingh / gist:1b5c77b5f35ba7008fbe78e4519b3818
Created July 20, 2020 14:51
Task 2 - Create a program in Java to declare, initialize and use local variables of all the primitive data types in Java.
//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;