Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikhil Raj Singh nikhilrajsingh

View GitHub Profile
View Lab4Task.java
/* 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;
View Lab3Task.java
/* 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 {
View Task2.java
/* 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;
View Task1.java
/* 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 Jul 20, 2020
task 1-Create a "Hello,World!" program in Java
View gist:8b1ca909fcfd6cf2b38359113a003125
//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 Jul 20, 2020
Task 2 - Create a program in Java to declare, initialize and use local variables of all the primitive data types in Java.
View gist:1b5c77b5f35ba7008fbe78e4519b3818
//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;
You can’t perform that action at this time.