Skip to main content

Posts

Showing posts from June, 2020

Java: what is Nested Classes?

What are Nested classes? What are Types of nested class? to know that read the following correctly and completely. NESTED CLASSES. In java , just like methods, variable of a class too can have another as its member writing a class within another is allowed in java. The class written within is called the nested class. and the class that holds the inner class is called the outer class. Syntax. class OuterClass {   //Dater member.   //Member methods   class InnerClass   {     //data members.    //member methods   } } Nested classes are divided into two types: Non-static nested classes Static nested classes. Non-static nested classes(Inner Classes). Inner classes are a security mechanism in java. We know a class cannot be associated with the access modifier private. but when we have class as a member of another class, then the inner class can be made private. They are further divided into 3 types. Inner class. Met...

Java: what is Static Member?

what is static member? what are the types of static variable?  to know that read the following care fully and completely. STATIC MEMBERS. Static member can be of static variable and static member.  STATIC VARIABLE. Static variable are global to a class and belong to the entire set of object that class creates. Only one memory location is created for each class variable. these are basically a static data members of a class. They take common value for all the objects. It is also known as class variable. STATIC METHODS. Static methods are the the method which behave same for the objects of a class. object are not needed to call static methods. object after insignificant with static methods. Nesting methods. A method can be called by using only its name by using only its name by another method of the same class. This is known as nesting of method. Java method permits nesting of methods freely.

Java: what is inheritances.

             What is Inheritance? what are its types? In general inheritance means take some qualities or behaves from our parents or grandparents. Do you thing inheritance it is related to java? well, YES ! it is related to java but why and how? To know that read the following carefully and completely . INHERITANCE. It is always a good idea to reuse something rater then creating or writing them from the beginning again. Inheritance in java, is the process of deriving a new class from an existing class. The existing class is known base, parent or super class. The derived class is known as derived,child or subclass. Defining a subclass.                  class derivedclassname extend superclassname {     //data member.    //member function. } example: class box {   int length:   int breath:   int height: } class colourbox exte...

JAVA: DECISION MAKING AND LOOPING.

JAVA.             Looping is an important topic, Which helps us to repeat a particular statement or a block of statement or an operation. so what is loop? what are the types of loop? how does it works? to know read the following carefully and completely. DECISION MAKING AND LOOPING.       When a sequence of statement is needed to be executed repetitively until some conditions for terminated the loop is satisfied.        Loops are required when a set of statement is must be executed repeatedly.        A looping structure is also known as iterative structure. This looping structure are classified into 2 groups.         Entry-control loop: The loop in which condition is checked first and then the body of the statement is executed.      eg: while loop, for loop.         Exit-control loop: The loop in which the body of the loop is executed first and the ...

JAVA: What are constructor?

JAVA.      Constructor is an important topic to write a java program. So, what is constructor? and what are the types of constructor? keep your mind concentrated and read the following completely to get the answer. CONSTRUCTOR.        A constructor is a member function(method/behavior) with a name same as a class name and it is automatically called  when the object is created.             Usually constructor is used to initialize the instants variables of the object. The general form of constructor is: class classname() {      //data member          classname()            {            //initialize data member              }   } Features of constructor. A constructor is a member function with a name same as a class name and it is automatically called  whe...

JAVA: WHAT ARE CLASSES?

JAVA.     We all come across a word class when we start reading java. So do you wanna know what is class? read the following carefully and completely to understand. CLASS. What is class?      A class is a collection of member, where the member can be member variable or member function. The member can be public or private.      Member variable of the class are called data member or attributes. Member functions in a class are called methods or behavior.      If we write any variable or function , it must be a member of some or other classes, so java is known as pure object oriented programming language.      A class in a java can be written using keywords.      A class with relative properties and operation is also known as abstract data types. A class contains  Data member. Methods. Constructor. Blocks. Classes and interface. General form to define a class is:   [access specifier] class classn...

JAVA: DECISION MAKING AND BRANCHING.

J AVA.      Do you wanted to know what is Decision making and branching? what are the types of branching? to know that read the following carefully and completely. DECISION MAKING AND BRANCHING.     The developer need to control the different section of the code that would be executed depending up on the data being processed.     In order to execute code  conditionally, the program should respond to condition. if condition is true the code should be executed. This process is basic of all program. Java has 3 decision making statement. if-statement switch case statement. conditional statement. If-statement.          The statement evaluated the expression first, and then depending on expression value the statements are executed. If the expression value is either true or false.  There are further grouped into 4. Simple if statement. If-else statement. Nested if statement. If else if statement. Simple if statement .  ...

JAVA: MATHEMATICAL FUNCTIONS.

JAVA. Do you wanted to know what is mathematical function?  to know that, read the following carefully and completely to understand. MATHEMATICAL FUNCTIONS. Other than addition, subtraction, multication and division, mathematics subject hold lots of operations like power, squaring, trigonometric functions etc... known as mathematical functions. Java provide access to such mathematical functions. They are all defined in the class called java.math.lang package. All of this function are static function, that is it can be assessed in the class name, there is no need to create an object for this. The following are some of the mathematical functions of java.   Function   Description sin(x); cos(x); tan(x); asin(x); acos(x); atan(x); sinh(x); cosh(x); tanh(x); exp(x); pow(x,y); sqrt(x); abs(x); ceil(x); floor(x); sine value of x. cosine value of x. tan value of x. inverse sine value of x. inverse cosine value of x. inverse tan value of x. hyperbolic sine value of x. hyperbol...

Java: expression.

JAVA.   Do you wanted to know what is expression? What are types of expression?to know that read the following carefully and completely to understand.   Expression. Combination of operator, constants and variable is known as Expression. There are 3 types of expression. Arithmetic expression. Relational expression. Logical expression. ARITHMETIC EXPRESSION. Arithmetic expression produce numeric value such as integer, float, double.      There are 3 modes. Integer arithmetic. Real arithmetic. Mixed arithmetic.      Integer arithmetic. If the operands are integer arithmetic operations yield an integer value.           An integer division is different from ordinary division, because the fraction           part of the quotionis truncated.      example:      5/3=1  but actual output is 1.51516. 4/7=0  but actual outout is 0.59123.   ...

JAVA: Operators.

JAVA.     Do you wanted to know what is operator? what are the types of operator? to know that read the following carefully and completely to understand. OPERATORS. Operators are Tokens, unit of instruction. An operator is a symbol that tells the computer to perform certain mathematical and logical manipulation. Operator is used in program to manipulate data or variable. There are 8 types of operator Arithmetic operator. Relational operator. Logical operator. Assignment operator.  Increment and Decrement operator. Conditional operator. Bitwise operator. Special operator Arithmetic operator.               Arithmetic operator are used to construct mathematical expressions. Java support 5 arithmetic operator.   Operator  D escription          +          -          *          /          %  Addition ...