0% found this document useful (0 votes)
3 views21 pages

Java New Notes

The document outlines the history and features of Java, detailing its development by Sun Microsystems in 1995 and its foundational principles such as simplicity, robustness, and portability. It explains key concepts of Java programming, including object-oriented principles like inheritance, polymorphism, and encapsulation, as well as the structure of Java programs. Additionally, it covers Java variables, data types, operators, and keywords, providing a comprehensive overview of the language's capabilities.

Uploaded by

girishgoudagng
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views21 pages

Java New Notes

The document outlines the history and features of Java, detailing its development by Sun Microsystems in 1995 and its foundational principles such as simplicity, robustness, and portability. It explains key concepts of Java programming, including object-oriented principles like inheritance, polymorphism, and encapsulation, as well as the structure of Java programs. Additionally, it covers Java variables, data types, operators, and keywords, providing a comprehensive overview of the language's capabilities.

Uploaded by

girishgoudagng
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

UNIT 1 PRAVEEN K AND

MALLIKARJUNAPPA D G
History of Java
The history of Java is very interesting. Java was originally designed for interactive television,

The history of Java starts with the Green Team. Java team members (also known as Green
Team),

Initiated this project to develop a language for digital devices such as set-top boxes,
televisions, etc.

The principles for creating Java programming were

Simple,

Robust

Portable,

Platform-independent,

Secured,

High Performance,

Multithreaded,

Object-Oriented,

Interpreted, and Dynamic.

Java was developed by James Gosling, who is known as the father of Java, in 1995.

Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year
1995

Initially it was designed for small, embedded systems in electronic appliances like set-top
boxes.

Firstly, it was called "Greentalk" by James Gosling, and the file extension was .gt.

After that, it was called Oak and was developed as a part of the Green project.

Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like
the U.S.A., France, Germany, Romania, etc.

In 1995, Oak was renamed as "Java" because it was already a trademark by Oak
Technologies.

What is Java?
1
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
Java is a programming language and a platform. Java is a high level, robust, object-
oriented and secure programming language.

Platform: Any hardware or software environment in which a program runs, is known as a


platform.

Simple java program

class Simple{
public static void main(String args[])
{
[Link]("Hello Java");
}
}

Object Orientated Java Concepts

Object

Any entity that has state and behaviour is known as an object. For example, a chair, pen, table,
keyboard, bike, etc. It can be physical or logical.

Class

Collection of objects is called class. It is a logical entity.

A class can also be defined as a blueprint from which you can create an individual object.

Inheritance

When one object acquires all the properties and behaviors of a parent object, it is known as
inheritance.

Advantage

It provides code reusability.

It is used to achieve runtime polymorphism.

Polymorphism

If one task is performed in different ways, it is known as polymorphism.

Abstraction

Hiding internal details and showing functionality is known as abstraction.


2
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
Encapsulation

Binding (or wrapping) code and data together into a single unit are known as encapsulation.

Structure of java programming

Documentation Section

The documentation section is an important section but optional for a Java program. It
includes basic information about a Java program. The information includes the author's
name, date of creation, version, program name, company name, and description of the
program.

Single-line Comment: It starts with a pair of forwarding slash (//).

Multi-line Comment: It starts with a /* and ends with */. We write between these two
symbols.

Documentation Comment: It starts with the delimiter (/**) and ends with */.

Package Declaration

3
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
The package declaration is optional. It is placed just after the documentation section. It must
be defined before any class and interface declaration.

package [Link];

Import Statements

The package contains the many predefined classes and interfaces. If we want to use any class
of a particular package, we need to import that class.

We use the import keyword to import the class. It is written before the class declaration and
after the package statement.

import [Link].*;

Interface Section

It is an optional section. We can create an interface in this section if required. We use


the interface keyword to create an interface. An interface is a slightly different from the
class. It contains only constants and method declarations.

interface car
{
}

Class Definition

In this section, we define the class. It is vital part of a Java program. Without the class we
cannot create any Java program. A Java program may conation more than one class
definition.

We use the class keyword to define the class.

class Student
{
}

Class Variables and Constants

In this section, we define variables and constants that are to be used later in the program.

In a Java program, the variables and constants are defined just after the class definition.

class Student
{
4
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
String sname;
int id;
}

Main Method Class

In this section, we define the main() method. It is essential for all Java programs. Because
the execution of all Java programs starts from the main() method. In other words, it is an
entry point of the class.

public static void main(String args[])


{
}
Methods

The methods are the set of instructions that we want to perform. These instructions execute at
runtime and perform the specified task.

public class GFGC


{
public static void main(String args[])
{
void display()
{
[Link]("Welcome To GFGC, Bapuji Nagar ,Shimoga");
}

Features of Java

 Simple,
 Robust
 Portable,
 Platform-independent,
 Secured,
 High Performance,
 Multithreaded,
 Object-Oriented,
 Interpreted, and Dynamic.

 Simple

Java is very easy to learn, and its syntax is simple, clean and easy to understand.

5
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G

o Java syntax is based on C++ (so easier for programmers to learn it after C++).

o Java has removed many complicated and rarely-used features, for example, explicit
pointers, operator overloading, etc.

Object-oriented

Java is an object-oriented programming language. Everything in Java is an object.

Basic concepts of OOPs are:

1. Object
2. Class
3. Inheritance
4. Polymorphism
5. Abstraction
6. Encapsulation

Platform Independent

Java is platform independent because it is different from other languages like C, C++, etc.

Java is a write once, run anywhere language.

A platform is the hardware or software environment in which a program runs.

Secured

Java is best known for its security. With Java, we can develop virus-free systems.

Java is secured because:

o No explicit pointer

o Java Programs run inside a virtual machine sandbox

Robust

The English mining of Robust is strong. Java is robust because:

o It uses strong memory management.

o There is a lack of pointers that avoids security problems.

o Java provides automatic garbage collection which runs on the Java Virtual Machine to
get rid of objects which are not being used by a Java application anymore.

6
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G

o There are exception handling and the type checking mechanism in Java.

Architecture-neutral

Java is architecture neutral because there are no implementation dependent features, for
example, the size of primitive types is fixed.

In C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4
bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32
and 64-bit architectures in Java.

Portable

Java is portable because it facilitates you to carry the Java byte code to any platform. It
doesn't require any implementation.

High-performance

Java is faster than other traditional interpreted programming languages because Java byte
code is "close" to native code. It is still a little bit slower than a compiled language (e.g., C+
+). Java is an interpreted language that is why it is slower than compiled languages, e.g., C,
C++, etc.

Distributed

Java is distributed because it facilitates users to create distributed applications in Java. RMI
and EJB are used for creating distributed applications. This feature of Java makes us able to
access files by calling the methods from any machine on the internet.

Multi-threaded

A thread is like a separate program, executing concurrently. We can write Java programs that
deal with many tasks at once by defining multiple threads. The main advantage of multi-
threading is that it doesn't occupy memory for each thread. It shares a common memory area.

Dynamic

Java is a dynamic language. It supports the dynamic loading of classes. It means classes are
loaded on demand. It also supports functions from its native languages, i.e., C and C++.

Java Variables

A variable is a container which holds the value while the Java program is executed. A
variable is assigned with a data type.

Variable is a name of memory location. There are three types of variables in java: local,
instance and static.

7
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
Variable

A variable is the name of a reserved area allocated in memory. In other words, it is a name of
the memory location. It is a combination of "vary + able" which means its value can be
changed.

int data=50;

Types of Variables

There are three types of variables in Java:

o local variable
o instance variable
o static variable

Local Variable

A variable declared inside the body of the method is called local variable.

Instance Variable

A variable declared inside the class but outside the body of the method, is called an instance
variable.

Static variable

A variable that is declared as static is called a static variable. It cannot be local. You can
create a single copy of the static variable and share it among all the instances of the class.

Rules to Declare a Variable

1. A variable name can consist of Capital letters A-Z, lowercase letters a-z digits 0-9, and
two special characters such as _ underscore and $ dollar sign.
2. The first character must not be a digit.
3. Blank spaces cannot be used in variable names.
4. Java keywords cannot be used as variable names.
5. Variable names are case-sensitive.
6. There is no limit on the length of a variable name but by convention, it should be
between 4 to 15 chars.
7. Variable names always should exist on the left-hand side of assignment operators.
Data Types in Java

Data types specify the different sizes and values that can be stored in the variable. There are
two types of data types in Java:

1. Primitive data types: The primitive data types include boolean, char, byte, short, int,
long, float and double.
8
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
2. Non-primitive data types: The non-primitive data types include Classes, Interfaces,
and Arrays.

Operators in Java

Operator in Java is a symbol that is used to perform operations.


For example: +, -, *, / etc.

There are many types of operators in Java which are given below:
o Unary Operator,
o Arithmetic Operator,
o Shift Operator,
o Relational Operator,
o Bitwise Operator,
o Logical Operator,
o Ternary Operator and
o Assignment Operator.

Java Unary Operator

The Java unary operators require only one operand.

o incrementing/decrementing a value by one


o negating an expression
o Inverting the value of a Boolean.

9
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
Java Arithmetic Operators

Java arithmetic operators are used to perform addition, subtraction, multiplication, and
division. They act as basic mathematical operations.

Java Left Shift Operator

The Java left shift operator << is used to shift all of the bits in a value to the left side of a
specified number of times.

Java Right Shift Operator

The Java right shift operator >> is used to move the value of the left operand to right by the
number of bits specified by the right operand.

Java AND Operator Example: Logical && and Bitwise &

The logical && operator doesn't check the second condition if the first condition is false. It
checks the second condition only if the first one is true.

The bitwise & operator always checks both conditions whether first condition is true or false.

Java OR Operator Example: Logical || and Bitwise |

The logical || operator doesn't check the second condition if the first condition is true. It
checks the second condition only if the first one is false.

The bitwise | operator always checks both conditions whether first condition is true or false.

Java Ternary Operator

Java Ternary operator is used as one line replacement for if-then-else statement and used a lot
in Java programming. It is the only conditional operator which takes three operands

int min=(a<b)?a:b;

Java Assignment Operator

Java assignment operator is one of the most common operators. It is used to assign the value
on its right to the operand on its left.

Java Keywords

Java keywords are also known as reserved words.

List of Java Keywords

A list of Java keywords or reserved words are given below:

10
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
1. abstract: Java abstract keyword is used to declare an abstract class. An abstract class
can provide the implementation of the interface. It can have abstract and non-abstract
methods.
2. boolean: Java boolean keyword is used to declare a variable as a boolean type. It can
hold True and False values only.
3. break: Java break keyword is used to break the loop or switch statement. It breaks the
current flow of the program at specified conditions.
4. byte: Java byte keyword is used to declare a variable that can hold 8-bit data values.
5. case: Java case keyword is used with the switch statements to mark blocks of text.
6. catch: Java catch keyword is used to catch the exceptions generated by try statements.
It must be used after the try block only.
7. char: Java char keyword is used to declare a variable that can hold unsigned 16-bit
Unicode characters
8. class: Java class keyword is used to declare a class.
9. continue: Java continue keyword is used to continue the loop. It continues the current
flow of the program and skips the remaining code at the specified condition.
10. default: Java default keyword is used to specify the default block of code in a switch
statement.
11. do: Java do keyword is used in the control statement to declare a loop. It can iterate a
part of the program several times.
12. double: Java double keyword is used to declare a variable that can hold 64-bit
floating-point number.
13. else: Java else keyword is used to indicate the alternative branches in an if statement.
14. enum: Java enum keyword is used to define a fixed set of constants. Enum
constructors are always private or default.
15. extends: Java extends keyword is used to indicate that a class is derived from another
class or interface.
16. final: Java final keyword is used to indicate that a variable holds a constant value. It
is used with a variable. It is used to restrict the user from updating the value of the
variable.
17. finally: Java finally keyword indicates a block of code in a try-catch structure. This
block is always executed whether an exception is handled or not.
18. float: Java float keyword is used to declare a variable that can hold a 32-bit floating-
point number.
19. for: Java for keyword is used to start a for loop. It is used to execute a set of
instructions/functions repeatedly when some condition becomes true. If the number of
iteration is fixed, it is recommended to use for loop.
20. if: Java if keyword tests the condition. It executes the if block if the condition is true.
21. implements: Java implements keyword is used to implement an interface.

11
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
22. import: Java import keyword makes classes and interfaces available and accessible to
the current source code.
23. instanceof: Java instanceof keyword is used to test whether the object is an instance
of the specified class or implements an interface.
24. int: Java int keyword is used to declare a variable that can hold a 32-bit signed
integer.
25. interface: Java interface keyword is used to declare an interface. It can have only
abstract methods.
26. long: Java long keyword is used to declare a variable that can hold a 64-bit integer.
27. native: Java native keyword is used to specify that a method is implemented in native
code using JNI (Java Native Interface).
28. new: Java new keyword is used to create new objects.
29. null: Java null keyword is used to indicate that a reference does not refer to anything.
It removes the garbage value.
30. package: Java package keyword is used to declare a Java package that includes the
classes.
31. private: Java private keyword is an access modifier. It is used to indicate that a
method or variable may be accessed only in the class in which it is declared.
32. protected: Java protected keyword is an access modifier. It can be accessible within
the package and outside the package but through inheritance only. It can't be applied
with the class.
33. public: Java public keyword is an access modifier. It is used to indicate that an item is
accessible anywhere. It has the widest scope among all other modifiers.
34. return: Java return keyword is used to return from a method when its execution is
complete.
35. short: Java short keyword is used to declare a variable that can hold a 16-bit integer.
36. static: Java static keyword is used to indicate that a variable or method is a class
method. The static keyword in Java is mainly used for memory management.
37. strictfp: Java strictfp is used to restrict the floating-point calculations to ensure
portability.
38. super: Java super keyword is a reference variable that is used to refer to parent class
objects. It can be used to invoke the immediate parent class method.
39. switch: The Java switch keyword contains a switch statement that executes code
based on test value. The switch statement tests the equality of a variable against
multiple values.
40. synchronized: Java synchronized keyword is used to specify the critical sections or
methods in multithreaded code.
41. this: Java this keyword can be used to refer the current object in a method or
constructor.

12
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
42. throw: The Java throw keyword is used to explicitly throw an exception. The throw
keyword is mainly used to throw custom exceptions. It is followed by an instance.
43. throws: The Java throws keyword is used to declare an exception. Checked
exceptions can be propagated with throws.
44. transient: Java transient keyword is used in serialization. If you define any data
member as transient, it will not be serialized.
45. try: Java try keyword is used to start a block of code that will be tested for
exceptions. The try block must be followed by either catch or finally block.
46. void: Java void keyword is used to specify that a method does not have a return value.
47. volatile: Java volatile keyword is used to indicate that a variable may change
asynchronously.
48. while: Java while keyword is used to start a while loop. This loop iterates a part of the
program several times. If the number of iteration is not fixed, it is recommended to
use the while loop.

Java Control Statements | Control Flow in Java

Java compiler executes the code from top to bottom. The statements in the code are executed
according to the order in which they appear. However, Java provides statements that can be
used to control the flow of Java code. Such statements are called control flow statements.

Java provides three types of control flow statements.

1. Decision Making statements


o if statements
o switch statement
2. Loop statements
o do while loop
o while loop
o for loop
o for-each loop
3. Jump statements
o break statement
o continue statement

Decision-Making statements:

Decision-making statements evaluate the Boolean expression and control the program flow
depending upon the result of the condition provided. There are two types of decision-making
statements in Java, i.e., If statement and switch statement.

13
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
If Statement:

In Java, the "if" statement is used to evaluate a condition. The control of the program is
diverted depending upon the specific condition. The condition of the If statement gives a
Boolean value, either true or false. In Java, there are four types of if-statements given below.

1. Simple if statement
2. if-else statement
3. if-else-if ladder
4. Nested if-statement

1) Simple if statement:

It is the most basic statement among all control flow statements in Java. It evaluates a
Boolean expression and enables the program to enter a block of code if the expression
evaluates to true.

if(condition) {
statement 1; //executes when condition is true
}

2) if-else statement

The if-else statement is an extension to the if-statement, which uses another block of code,
i.e., else block. The else block is executed if the condition of the if-block is evaluated as false.

if(condition) {
statement 1; //executes when condition is true
}
else{
statement 2; //executes when condition is false
}

3) if-else-if ladder:

The if-else-if statement contains the if-statement followed by multiple else-if statements.

if(condition 1) {
statement 1; //executes when condition 1 is true
}
else if(condition 2) {
statement 2; //executes when condition 2 is true
}
else {
statement 2; //executes when all the conditions are false
}
14
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
Nested if-statement

In nested if-statements, the if statement can contain a if or if-else statement inside another if
or else-if statement.

if(condition 1) {
statement 1; //executes when condition 1 is true
if(condition 2) {
statement 2; //executes when condition 2 is true
}
else{
statement 2; //executes when condition 2 is false
}
}

Switch Statement:

In Java, Switch statements are similar to if-else-if statements. The switch statement contains
multiple blocks of code called cases and a single case is executed based on the variable which
is being switched.

Rules of Switch Statement

o The case variables can be int, short, byte, char, or enumeration. String type is also
supported since version 7 of Java
o Cases cannot be duplicate
o Default statement is executed when any of the case doesn't match the value of
expression. It is optional.
o Break statement terminates the switch block when the condition is satisfied.
It is optional, if not used, next case is executed.
o While using switch statements, we must notice that the case expression will be of the
same type as the variable. However, it will also be a constant value.

Syntax:

switch (expression)
{
case value1:
statement1;
break;
.
.
.
case valueN:
statementN;
15
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
break;
default:
default statement;
}

Loop Statements

In programming, sometimes we need to execute the block of code repeatedly while some
condition evaluates to true. However, loop statements are used to execute the set of
instructions in a repeated order. The execution of the set of instructions depends upon a
particular condition.

In Java, we have three types of loops that execute similarly. However, there are differences in
their syntax and condition checking time.

1. for loop
2. while loop
3. do-while loop

Java for loop

In Java, for loop is similar to C and C++. It enables us to initialize the loop variable, check
the condition, and increment/decrement in a single line of code. We use the for loop only
when we exactly know the number of times, we want to execute the block of code.

1. for(initialization, condition, increment/decrement) {


2. //block of statements
3. }

Java while loop

The while loop is also used to iterate over the number of statements multiple times.

16
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
It is also known as the entry-controlled loop since the condition is checked at the start of the
loop. If the condition is true, then the loop body will be executed; otherwise, the statements
after the loop will be executed.

1. while(condition){
2. //looping statements
3. }

Java do-while loop

The do-while loop checks the condition at the end of the loop after executing the loop
statements. When the number of iteration is not known and we have to execute the loop at
least once, we can use do-while loop.

It is also known as the exit-controlled loop since the condition is not checked in advance.

1. do
2. {
3. //statements
4. } while (condition);

17
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G

Jump Statements
Jump statements are used to transfer the control of the program to the specific statements. In
other words, jump statements transfer the execution control to the other part of the program.
Java break statement:
As the name suggests, the break statement is used to break the current flow of the program
and transfer the control to the next statement outside a loop or switch statement.
Java continue statement:
it skips the specific part of the loop and jumps to the next iteration of the loop immediately.

Method Overloading in Java

If a class has multiple methods having same name but different in parameters, it is known
as Method Overloading

Advantage of method overloading

Method overloading increases the readability of the program.

Different ways to overload the method

There are two ways to overload the method in java

1. By changing number of arguments


2. By changing the data type

18
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
1) Method Overloading: changing no. of arguments
class Adder{
static int add(int a,int b){return a+b;}
static int add(int a,int b,int c){return a+b+c;}
}
class TestOverloading1{
public static void main(String[] args){
[Link]([Link](11,11));
[Link]([Link](11,11,11));
}}
2) Method Overloading: changing data type of arguments
class Adder{
static int add(int a, int b){return a+b;}
static double add(double a, double b){return a+b;}
}
class TestOverloading2{
public static void main(String[] args){
[Link]([Link](11,11));
[Link]([Link](12.3,12.6));
}}

Java Arrays

An array is a collection of similar type of elements which has contiguous memory location.

 Java array is an object which contains elements of a similar data type.


 The elements of an array are stored in a contiguous memory location.
 We can store only a fixed set of elements in a Java array.

Advantages
o Code Optimization: It makes the code optimized, we can retrieve or sort the data
efficiently.
o Random access: We can get any data located at an index position.

Disadvantages
o Size Limit: We can store only the fixed size of elements in the array. It doesn't grow
its size at runtime. To solve this problem, collection framework is used in Java which
grows automatically.

Types of Array in java

There are two types of array.

19
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G
o Single Dimensional Array
o Multidimensional Array

Single Dimensional Array in Java

Syntax to Declare an Array in Java:

 dataType[] arr; (or)


 dataType []arr; (or)
 dataType arr[];

Multidimensional Array in Java

In such case, data is stored in row and column based index (also known as matrix form).

Syntax to Declare Multidimensional Array in Java:

 dataType[][] arrayRefVar; (or)


 dataType [][]arrayRefVar; (or)
 dataType arrayRefVar[][]; (or)
 dataType []arrayRefVar[];
Java Math class

Java Math class provides several methods to work on math calculations like min(), max(),
avg(), sin(), cos(), tan(), round(), ceil(), floor(), abs() etc.

Package of math class is import [Link];

public class JavaMathExample1


{
public static void main(String[] args)
{
double x = 28;
double y = 4;

// return the maximum of two numbers


[Link]("Maximum number of x and y is: " +[Link](x, y));

// return the square root of y


[Link]("Square root of y is: " + [Link](y));

//returns 28 power of 4 i.e. 28*28*28*28


[Link]("Power of x and y is: " + [Link](x, y));
}
}
20
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA
UNIT 1 PRAVEEN K AND
MALLIKARJUNAPPA D G

21
GOVT. FIRST GRADE COLLEGE
SHIVAMOGGA

You might also like