-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81c0480
commit 0a33ca2
Showing
19 changed files
with
274 additions
and
0 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,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
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,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>LogicalProgram</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
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,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
19 changes: 19 additions & 0 deletions
19
LogicalProgram/src/com/akash/abstractExample/Rectangle.java
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,19 @@ | ||
package com.akash.abstractExample; | ||
|
||
public class Rectangle extends Shape{ | ||
|
||
@Override | ||
public void calculateArea() { | ||
// TODO | ||
|
||
} | ||
|
||
// its Example of Abstraction and Inheritance | ||
public static void main(String arg[]) { | ||
Rectangle rectangle = new Rectangle(); | ||
rectangle.display(); | ||
//rectangle.b = 20; | ||
|
||
} | ||
|
||
} |
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,11 @@ | ||
package com.akash.abstractExample; | ||
|
||
abstract class Shape { | ||
final int b = 20; | ||
public void display() { | ||
System.out.println("This is display method....."); | ||
} | ||
|
||
abstract public void calculateArea(); | ||
|
||
} |
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 com.akash.banking; | ||
|
||
public class Deposit { | ||
|
||
} |
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 com.akash.banking; | ||
|
||
public class Withdrawal { | ||
|
||
} |
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 com.akash.designPattern; | ||
|
||
public class Singleton { | ||
|
||
private static Singleton singleton = null; | ||
//private static Singleton singleton = null; | ||
|
||
private Singleton() { | ||
// constructor | ||
} | ||
|
||
public static Singleton getInstance() { | ||
if(singleton == null) { | ||
singleton = new Singleton(); | ||
} | ||
return singleton; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
LogicalProgram/src/com/akash/designPattern/SingletonDemo.java
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 com.akash.designPattern; | ||
|
||
public class SingletonDemo { | ||
|
||
private static SingletonDemo singleton = null; | ||
|
||
private SingletonDemo() { | ||
// TODO | ||
} | ||
|
||
public static SingletonDemo getInstance() { | ||
if(singleton == null) { | ||
singleton = new SingletonDemo(); | ||
} | ||
return singleton; | ||
} | ||
|
||
} |
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 com.akash.inheritance.poly; | ||
|
||
public class Animal { | ||
|
||
private int a; | ||
int b; | ||
|
||
public void onEating() { | ||
System.out.println(" This is eating method of Animal class "); | ||
} | ||
|
||
|
||
} |
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,15 @@ | ||
package com.akash.inheritance.poly; | ||
|
||
public class Dog extends Animal{ | ||
int c; // new instance variable of class Dog | ||
|
||
public void onEating() { | ||
// overridden method | ||
System.out.println("this is method onEating of class Dog"); | ||
} | ||
public void onAction() { | ||
super.onEating(); | ||
System.out.println("This is method onAction of class Dog"); | ||
} | ||
|
||
} |
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 com.akash.inheritance.poly; | ||
|
||
public class Runner { | ||
|
||
public static void main(String[] arg) { | ||
Animal animal = new Animal(); | ||
Dog dog = new Dog(); | ||
|
||
Animal ani = new Dog(); | ||
System.out.println(" Animal: + : + "); | ||
|
||
ani.onEating(); // Dog class | ||
|
||
System.out.println(" Animal : + : "); | ||
//dog.onEating(); | ||
|
||
dog.onAction(); | ||
|
||
animal.onEating(); | ||
|
||
} | ||
|
||
} |
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,10 @@ | ||
package com.akash.overriding; | ||
|
||
public class Doctor { | ||
|
||
public void treatPatient(){ | ||
//treatPatient method | ||
System.out.println("Doctor is executed........."); | ||
} | ||
|
||
} |
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 com.akash.overriding; | ||
|
||
public class MainClass { | ||
|
||
public static void main(String[] args) { | ||
Doctor doctor = new Doctor(); | ||
doctor.treatPatient(); | ||
|
||
Surgeon surgeon = new Surgeon(); | ||
surgeon.treatPatient(); | ||
|
||
Doctor s = new Surgeon(); | ||
System.out.println(" -----"); | ||
s.treatPatient(); /*Base class Surgeon*/ | ||
|
||
} | ||
|
||
} |
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,9 @@ | ||
package com.akash.overriding; | ||
|
||
public class Surgeon extends Doctor{ | ||
|
||
public void treatPatient() { | ||
System.out.println("Surgeon is executed.........."); | ||
} | ||
|
||
} |
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,21 @@ | ||
package com.akash.staticBlock; | ||
|
||
public class Demo { | ||
|
||
int a; | ||
static int b; | ||
|
||
static { | ||
System.out.println("Hello"); | ||
} | ||
|
||
public static void main(String[] args) { | ||
String abc ="abc"; | ||
String abcd = "abcd"; | ||
|
||
System.out.println(abc+" "+abcd); | ||
|
||
System.out.println("Value of a = "+ new Demo().a); | ||
System.out.println("Value of b = "+ b); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
LogicalProgram/src/com/akash/stringBuffer/StringBufferDemo.java
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 com.akash.stringBuffer; | ||
|
||
public class StringBufferDemo { | ||
|
||
public static void main(String[] args) { | ||
StringBuffer stringBuffer = new StringBuffer("Akash"); | ||
int length1 = stringBuffer.length(); | ||
System.out.println(":::: "+length1); | ||
stringBuffer.append(" Kumar"); | ||
int length = stringBuffer.length(); | ||
int capacity = stringBuffer.capacity(); | ||
System.out.println(capacity+ " : : capacity"); | ||
System.out.println(length); | ||
|
||
System.out.println(stringBuffer); | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
LogicalProgram/src/com/akash/stringBuffer/StringBuffereReverse.java
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,16 @@ | ||
package com.akash.stringBuffer; | ||
|
||
public class StringBuffereReverse { | ||
|
||
public static void main(String[] args) { | ||
StringBuffer stringBuffer = new StringBuffer("Akash"); | ||
|
||
stringBuffer.reverse(); | ||
|
||
System.out.println(stringBuffer); | ||
|
||
stringBuffer.delete(0, 2); | ||
System.out.println(stringBuffer); | ||
|
||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
LogicalProgram/src/com/akash/stringbuilder/StringBuilderDemo.java
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,21 @@ | ||
package com.akash.stringbuilder; | ||
|
||
public class StringBuilderDemo { | ||
|
||
public static void main(String[] args) { | ||
|
||
StringBuilder str = new StringBuilder("Akash Kumar"); | ||
str.append(" Singh"); | ||
|
||
System.out.println("String : "+ str.toString()); | ||
System.out.println("String without : "+str); | ||
|
||
str.reverse(); | ||
System.out.println(str); | ||
|
||
|
||
|
||
|
||
} | ||
|
||
} |