Skip to content

Commit

Permalink
logical program update
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAkashKumar committed Oct 10, 2020
1 parent 81c0480 commit 0a33ca2
Show file tree
Hide file tree
Showing 19 changed files with 274 additions and 0 deletions.
6 changes: 6 additions & 0 deletions LogicalProgram/.classpath
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>
17 changes: 17 additions & 0 deletions LogicalProgram/.project
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>
11 changes: 11 additions & 0 deletions LogicalProgram/.settings/org.eclipse.jdt.core.prefs
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 LogicalProgram/src/com/akash/abstractExample/Rectangle.java
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;

}

}
11 changes: 11 additions & 0 deletions LogicalProgram/src/com/akash/abstractExample/Shape.java
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();

}
5 changes: 5 additions & 0 deletions LogicalProgram/src/com/akash/banking/Deposit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.akash.banking;

public class Deposit {

}
5 changes: 5 additions & 0 deletions LogicalProgram/src/com/akash/banking/Withdrawal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.akash.banking;

public class Withdrawal {

}
18 changes: 18 additions & 0 deletions LogicalProgram/src/com/akash/designPattern/Singleton.java
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 LogicalProgram/src/com/akash/designPattern/SingletonDemo.java
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;
}

}
13 changes: 13 additions & 0 deletions LogicalProgram/src/com/akash/inheritance/poly/Animal.java
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 ");
}


}
15 changes: 15 additions & 0 deletions LogicalProgram/src/com/akash/inheritance/poly/Dog.java
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");
}

}
23 changes: 23 additions & 0 deletions LogicalProgram/src/com/akash/inheritance/poly/Runner.java
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();

}

}
10 changes: 10 additions & 0 deletions LogicalProgram/src/com/akash/overriding/Doctor.java
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.........");
}

}
18 changes: 18 additions & 0 deletions LogicalProgram/src/com/akash/overriding/MainClass.java
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*/

}

}
9 changes: 9 additions & 0 deletions LogicalProgram/src/com/akash/overriding/Surgeon.java
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..........");
}

}
21 changes: 21 additions & 0 deletions LogicalProgram/src/com/akash/staticBlock/Demo.java
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 LogicalProgram/src/com/akash/stringBuffer/StringBufferDemo.java
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);
}

}
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 LogicalProgram/src/com/akash/stringbuilder/StringBuilderDemo.java
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);




}

}

0 comments on commit 0a33ca2

Please sign in to comment.