-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
275 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/CharDemo.java=UTF-8 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org; | ||
|
||
import org.accm.Employee; | ||
|
||
public class EmployeeChild extends Employee{ | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org; | ||
|
||
import org.accm.Employee; | ||
|
||
public class EmployeeTest { | ||
public static void main(String[] args) { | ||
Employee emp = new Employee(); | ||
System.out.println(emp.id); | ||
System.out.println(emp.name); | ||
System.out.println(emp.address); | ||
System.out.println(emp.email); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org; | ||
|
||
import java.util.Scanner; | ||
|
||
// 5! = 5 * 4 * 3 * 2 * 1 | ||
public class Factorial { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
|
||
System.out.println("Enter Factorial No:"); | ||
int no = sc.nextInt(); | ||
|
||
long factNo = 1; | ||
for (int i = no; i >= 1; i--) { | ||
factNo = factNo * i; | ||
} | ||
|
||
System.out.println("Factorial of "+ no + " is: "+ factNo); | ||
|
||
sc.close(); | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.accm; | ||
|
||
public class Employee { | ||
private int id; | ||
private String name; | ||
private String email; | ||
|
||
//Setter | ||
public void setId(int id){ | ||
this.id = id; | ||
} | ||
public void setName(String name){ | ||
this.name = name; | ||
} | ||
public void setEmail(String email){ | ||
this.email = email; | ||
} | ||
|
||
//GETTER | ||
public int getId(){ | ||
return id; | ||
} | ||
public String getName(){ | ||
return name; | ||
} | ||
public String getEmail(){ | ||
return email; | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
return id + " " + name + " " + email; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.accm; | ||
|
||
public class EmployeeMain { | ||
public static void main(String[] args) { | ||
Employee emp = new Employee(); | ||
|
||
//emp.id = 10; | ||
emp.setId(10); | ||
|
||
//emp.name = "SHYAM"; | ||
emp.setName("SHYAM"); | ||
|
||
//emp.email = "[email protected]"; | ||
emp.setEmail("[email protected]"); | ||
|
||
//GETTER | ||
System.out.println("ID: "+ emp.getId()); | ||
System.out.println("Name: "+ emp.getName()); | ||
System.out.println("Email: " + emp.getEmail()); | ||
|
||
|
||
System.out.println(emp); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package org.accm; | ||
|
||
public class Student { | ||
|
||
private int id; | ||
private String name; | ||
private String email; | ||
private double fee; | ||
private String address; | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
|
||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
||
|
||
|
||
public double getFee() { | ||
return fee; | ||
} | ||
|
||
|
||
|
||
public void setFee(double fee) { | ||
this.fee = fee; | ||
} | ||
|
||
|
||
|
||
public String getAddress() { | ||
return address; | ||
} | ||
|
||
|
||
|
||
public void setAddress(String address) { | ||
this.address = address; | ||
} | ||
|
||
|
||
|
||
@Override | ||
public String toString() { | ||
return getId() + " " + name + " " + email + " " + fee + " " + address; | ||
} | ||
|
||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.accm; | ||
|
||
public class User { | ||
private int id; | ||
private String name; | ||
private String email; | ||
|
||
public User(int id, String name, String email) { | ||
this.id = id; | ||
this.name = name; | ||
this.email = email; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return id + " "+ name + " " + email; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.accm; | ||
|
||
public class UserMain { | ||
public static void main(String[] args) { | ||
User usr = new User(5, "RAM", "[email protected]"); | ||
System.out.println(usr); // .toString() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package org.javastud.studm.constructor; | ||
package org.constructor; | ||
|
||
public class Volume { | ||
int length; | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.imports.service; | ||
|
||
public class BigDecimal { | ||
public static final double MAX_DIGIT = 3222.14544232; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.imports.service; | ||
|
||
public class UserService { | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.imports.util; | ||
|
||
import java.io.File; | ||
|
||
/*import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.Scanner;*/ | ||
|
||
import java.util.*; | ||
|
||
import org.imports.service.BigDecimal; | ||
import org.imports.service.UserService; | ||
|
||
public class FileUtil { | ||
public static void main(String[] args) { | ||
|
||
// Date and Time: use java class Date | ||
Date d = new Date(); | ||
System.out.println(d); | ||
|
||
ArrayList lst = new ArrayList(); | ||
|
||
// ----------Read program--------- | ||
Scanner sc = new Scanner(System.in); | ||
|
||
System.out.println("Enter your Name: "); | ||
String s = sc.nextLine(); | ||
System.out.println("Name: " + s); | ||
|
||
System.out.println("Enter your age: "); | ||
int age = sc.nextInt(); | ||
System.out.println("Age: " + age); | ||
// -------------------------- | ||
|
||
UserService us = new UserService(); | ||
File f = new File("D:\\abc.txt"); | ||
|
||
// No import | ||
// 1. for same package classess | ||
MathUtils mathUtil = new MathUtils(); | ||
|
||
// 2. For package: java.lang | ||
// Example String, Math | ||
System.out.println(Math.PI); | ||
|
||
BigDecimal bd = new BigDecimal(); | ||
java.math.BigDecimal ten = new java.math.BigDecimal("10"); | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.imports.util; | ||
|
||
import static java.lang.System.out; | ||
import static org.imports.service.BigDecimal.MAX_DIGIT; | ||
|
||
public class MathUtils { | ||
public static void main(String[] args) { | ||
out.println(Math.PI); | ||
System.out.println(MAX_DIGIT); // BigDecimal.MAX_DIGIT | ||
System.out.println(MAX_DIGIT); | ||
System.out.println(MAX_DIGIT); | ||
System.out.println(MAX_DIGIT); | ||
} | ||
} |