Python introduction-1

Today I learn new programming language python. It is an Popular language.

What is python?

Python is an high level programming language. It is both object oriented and procedure oriented language.

History?

Created by Guido van Rossum in 1991.The author is big fan on tv show”Monty Python’s “. So the name python is created.

Features?

Simple language and easier to learn. Free and open source internet. Extensible and embeddable. Large standard libraries to solve common task.

Versions?

Python latest version is python 3.8.3 documentation released on 13 May 2020.

Python installation?

For windows=https://www.python.org. For Linux=terminal-sudo-apt-get install 3.8

Oops(inheritance &abstract class)

Inheritance

We leran anything,first we know that the question why, what, how, when.

What is inheritance?
             An object of one class acting as an object of another class. 
When I go for inheritance? 
             When there is an "IS-A" Relationship between two classes, we can go for inheritance. 
How inheritance achieving in java? 
                We use "extends" Keyword in java for achieving inheritance. 
Why should I leran inheritance? 
                For achieving code Reusability and efficient memory management. 
Parent class=supper class, base class. 
Child class=sub class, derived class. 
Types of inheritance
   1.single inheritance:
         Refers to a child and parent class relationship.  Where a child class exteds a parent class. 
Example:
Actor kamalhassan and his daughter shruthi Hassan. 
Program:
Public class kamlhassan{
String religion="Hindu";
Int salary=1000000;
    Public static void main(string[]args) {class Teacher { 
       Kamalhassan khan=new kamalhassan () ;
       Kh. Actor() ;
Public void actor () 
{
System.out.println("good actor ") ;
}
Public void sing() 
{
System.Out.Println(" Singing songs ") ;
}
Private void bigboss() 
{
System. Out. Println(" Makkal prathinithi") ;
}
Protrcted void interview () 
{
System.out.println("give interview ") ;
}
Void lifestyle () ;
{
System. Out. Println(" Luxury life") ;
}
}}



Public class shruthi extends kamlhassan{
String religion="Christian";
Int salary=100000;
    Public static void main(string[]args) {
Shruthi sh=sruthi() ;      
 Sh. Actor() ;
Public void actor () {
System.out.println("good actor ") 
;
}
Public void sing() {
system.Out.Println(" Singing songs ") ;
}
void bigboss {  //not access
System. Out. Println(" Makkal prathinithi");
}
Protected void interview () {
System.out.println("give interview ") ;}}}

The above example, 
1.it is not necessary for the child class(shruthi) inherit all the properties of parent class. 
2.including child class we cannot access private variables and method of any object. 
3 child class can have extra own methods and variables. 
4.we can access protected variables, object, methods from any class in child class. 
5.we can use method overriding in two different classes (act local variable first). 
2.multi level inheritance:
         refers to a child and parent class relationship where a class extends the child class. For example class C extends class B and class B extends class A.
Example: shruthi son's. 
Program:
Public class shruthison etends shruthi {
Public static void main(string []args) 
{
Shruthison ss=new shruthison() ;
Ss. Sing() ;
Ss. Actor () ;
Ss. Lifestyle () ;
System. Out. Println(ss.religion) ;
}
Private void go to school () 
{
System. Out. Println () ;
}}}
The above example, grand child can access the parent and grand parentparent properties. 
3.multiple inheritance:
     Java is not supporting multiple inheritance. They say multiple inheritance is leads to ambiguity or it will lead to diamond problem. After exteds key word there should be only one class name. It means., multiple inheritance have one child many parent. 
4.hirarchical inheritance:
refers to a child and parent class relationship where more than one classes extends the same class. For example, classes B, C & D extends the same class A.
Example kamalhassan another daughter akshrahassan. 
Program:
Public class akshara extends kamlhassan {
String religion=("Muslim");
Int salary=100000;
Akshara ak= new akshara() ;
Ak. Lifestyle () ;
Ak. Sing() ;
}
Void heroin () 
{
System. Out. Println ("wow") ;
}
The above example akshara also access kamalhassan properties. 
5.Hybrid inheritance:
Combination of more than one types of inheritance in a single program. For example class A & B extends class C and another class D extends class A then this is a hybrid inheritance example because it is a combination of single and hierarchical inheritance.
Example= family tree. 

While loop

What is while loop? 
     Java while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement.
syntax:
Example program1:
   // Given a num, returns how many times can we divide it by 2 to get down to 1.
int count2Div(int num) { 
 int count = 0;   // count how many divisions we've done
  while (num >= 1) {    
num = num / 2;   
count++;  
} 
 return count;
}
Example program 2:
{
int count=0;
while(count<=5) 
{
int mark=90;
Count=count+1;
}
Scanner class:
       Scanner is a class in java. util package used for obtaining the input of the primitive types like int, double, etc. and strings. It is the easiest way to read input in a Java program, though not very efficient if you want an input method for scenarios where time is a constraint like in competitive programming.
Example:
{
int count=0;
while (count<=5) 
{
System.out.println("enter marks") ;
Scanner. scanner=new scanner(System.in) ;
int mark=Scanner.nextInt() ;
Count=count+1;
System.out.println(count) ;
}
Import:
     import is a keyword. import keyword is used to import built-in and user-defined packages into your java source file so that your class can refer to a class that is in another package by directly using its name.

Reference by=quora.com,geeksforgeeks.com

Method and if Statment (day-7)

What is method:
            Method is a sequence of instructions with the name. 
            Main method is a execution starting point. 
Ex:
     OpenEclipse() { 
            1.start on
            2. Eclipse type
            3.click the button
            4.launch
         }
Modularity:
          Modularity  To the concept of making multiple  first and then linking and combining them to From a complete system. 
Use:editing easy and make easy to run program. 
Method calling:
               method returns a value or  returning nothing (no return value). 
Ex: robot.calculateTotal();
Object creation:
                 MyObject obj =newMyObject();
Code Resuability:
You can use the same fields and methods already defined in the previous class.
If statement:
Use the if statement to specify a block of Java code to be executed if a condition is true.
Synatx:
if (condition) {  
// block of code to be executed if the condition is true
}
If else statement:
Use the else statement to specify a block of code to be executed if the condition is false.
syntax: 
if (condition) {
  // block of code to be executed if the condition is true
} 
else {  
// block of code to be executed if the condition is false
}
Nested if statement:
It is always legal to nest if-else statements which means you can use one if or else if statement inside another if or else if statement.
syntax: 
if(Boolean_expression 1) {
   // Executes when the Boolean expression 1 is true   if(Boolean_expression 2) {   
   // Executes when the Boolean expression 2 is true   
}
}
 References by=w3 schools. Com and tutorial point. Com

Methods and static keyword (day-6)

Methods:
          A java method is  Collection of statement that are grouped together to perform an operation. 
*methods= behavior. 
            How jdk identify a method is starting with the symbol (). 
Main methods:
             Main method= important activity. Example: bike. Main method have method body or method definition within the open and close brackets. 
              Jvm starts reading the program from the main method. 
*Declarion part ex=int tamil, english;
*Initialization part ex=int tamil=90;
                                        int english=80;

Method example:
Static keyword:
              Static members are common to all the objects. It associated with class, rather than with any object. 
              Static doesn't mean a constant. And store only ones. 
               It is a class level memory. 
Reference by: tutorials point and mathbit. Com

Day-3 learning java

Today we learn about datatypes.

Datatypes are two types:

1.primetive datatypes

2.Non primitive datatypes

Primitive datatypes:

Java having 8 primitive datatypes.thats are:integer, float, char, boolean, long, double, byte, short.

1.integer:

An integer is a whole number that can be passitive, negative or zero.

It has 4 bytes of memory space and range=-2147483648 to 2147483647.

Float:

An float is represents decimal values. Ex:a=5.6

It has 4 bytes of memory space and range=±3.40282347E+38F .

Character:

An character is a single character that is letter, digit, space, a tab, punctuation mark.

It has 2 bytes of memory space and range=0 to 65,536 (unsigned).

Boolean:

An boolean is a true Or false value.

It Range is true Or false.

Long:

The long datatype a 64 bit two’ complement integer.

It has 8 bytes and range=-9,223,372,036,854,775,808 to9,223,372,036,854,775,807.

Double :

the double datatype is double precision 64-bit IEEE 754 floating point.

It has 8 bytes memory space.and range=±1.79769313486231570E+308.

Short:

The short datatype is a 16-bit signed two complement integer.

It has two bytes and range=-32,768 to 32,767.

Byte:

The byte datatype is an 8-bit signed two complement integer.

It has 1 byte memory space and range=-128 to 127.

Day-2 learning Java

Open source:

Java is a open source. It is free and anyone can access. Ex: c, C++,c#,python.

Closed source:

Closed source is unsecure.

Version control system:

It can be thought as a Database of changes. It contains all the edits and historical version of the project. Ex:GITHUB.com

Difference between c, c++and Java:

1.c and c++ is using pointers. Java not having pointers.

2.c and c++ using destrucor to delete un wanted object. But Java using automatic garbage collection.

Difference between Java and Java script:

1.Java is a programming language. javascript is a scripting language.

2.programing language using complier and scripting language using interpreter.

3.java and javascript is separated one. No connection to both.

Full stack development:

It contains three parts. That is front and, middle and database.

Front end=html, css, javascript.

Middle=Java

Data base= mysql, etc.

My learning experience

This is my first blog, I shared my java learning experience.

Today’s agenda:

~What is java?

~Why learn java?

~Java complier
Java interpreter

~Byte code

~Java virtual machine

~Java runtime environment

~Just in time

~Java development kit

~How to works Java

What is Java?

Java is high level programming language. It is pure object oriented programming language. We learn java is very easy and simple.

Developed by James Gosling in USA-1991.

Why learn Java?

Java works on different platforms (Mac, windows, Linux etc). Java is very very easy to learn and simple. And it’s platforms independent.

Java complier

Java complier sending machine code to the interpreter.

Java interpreter

Interpreter Represending machine code( class file) into byte code.

Byte code

Byte code is program code that has been complied from source code into low level code(0, 1).

Java virtual machine

JVM is the runtime engine that enables a computer to run java programs as well as programs written in other language that are also complied to java byte code.

Just in time

A complier that converts machine code to byte code just before the program is run.

Java runtime environment

It is a set of software tools. JRE=JVM+JIT.

Java development kit

It is used to build and develop the Java program. It contains JRE. Without JDK we can’t build any Java program.

How to works

Design a site like this with WordPress.com
Get started