Answer the question and discuss if you have any confusion

Answer the question and discuss if you have any confusion

by Md Assaduzzaman -
Number of replies: 12

1 . Why static keyword is important in java ?

2.  What is the advantages of method?

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Arpita Ghosh -
1. Answer: In Java, static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class. A member variable of a class that is declared as static is called the Static Variable. It is also called as the “Class variable”. Once the variable is declared as static, memory is allocated only once and not every time when a class is instantiated. Hence you can access the static variable without a reference to an object.

2. Answer: Method overloading increases thereadability of the program. Overloaded methods give programmers theflexibility to call a similar method for different types of data. Overloading is also used on constructors to create new objects given different amounts of data.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sadid Ahmed -
1. Ans : In Java, static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class.
2. Ans : Methods allow us to reuse the code without retyping the code. In Java, every method must be part of some class which is different from languages like C, C++, and Python. Methods are time savers and help us to reuse the code without retyping the code.
Advantages of using the Methods :

It makes the program well structured.
Methods enhance the readability of the code.
It provides an effective way for the user to reuse the existing code.
It optimizes the execution time and memory space.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mahmudur Rahman -
Answer to the question number 1:
In Java, static keywords are mainly used for memory management. We can use static keywords with variables, methods, blocks and home classes.
If the static keyword is applied to a class, all the members of the class must be static. Classes, interfaces, and static classes may have static constructors.
Answer to the question number 2:
Naming an appropriate method increases reading and understanding of the purpose of the method. Multiply
(int x, int y) Here you will immediately understand that this method will multiply the double digit values.
This increases the reusability of the code and thus reduces the size of the code.
The complex problem can be modulated with the help of methods.
If the code is written without method, it will be very large in size and thus it will be difficult to test, correct and maintain the code.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Akash das -
1. static is a non-access modifier in Java. To create a static member(block,variable,method,nested class), precede its declaration with the keyword static. When a member is declared static, it can be accessed before any objects of its class are created, and without reference to any object.

2. Advantages of method :
It makes the program well structured.
Methods enhance the readability of the code.
It provides an effective way for the user to reuse the existing code.
It optimizes the execution time and memory space.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Rukya Islam -
1.
In Java, static keyword is important for worst the memory.static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class.
2.
For help of method we can declaire variable one time.method have many advantages such as:

The methods help in data security .
The methods also enable polymorphism .
Methods can be overloaded or over ridden .
Methods allow recursion .
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Azmol Huda Nahid -
1.Static keywords have only one value which is used by all the objects in the class.
We don’t need to create an object when we are using a static variable or method in another static method, we can directly use it.
Real world example of Why do we use static keywords:- Suppose you are making an app for a bank, every person has different account number in the bank but rate of interest is same for all . So, you need to make the rate of interest Static as its common for all. You can make account number instance , which will have different copies for different objects
2.A method is a block of code which only runs when it is called. coder can pass data, known as parameters, into a method. Methods are used to perform certain actions, and they are also known as functions.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Inzamamul Haque -
1. In Java, static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class.

2. The advantages of method:
a. The methods help in data security .
b. The methods also enable polymorphism .
c. Methods can be overloaded or over ridden .
d. Methods allow recursion and it acts as a loop .
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mufty _ -
Ans_01:

In Java, static keyword is important for worst the memory.static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class.

Ans_02:
For help of method we can declaire variable one time.method have many advantages such as:

1.The methods help in data security .
2.The methods also enable polymorphism .
3.Methods can be overloaded or over ridden .
4.Methods allow recursion .
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mehedi Hasan -
1. Answer: In Java, static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class. A member variable of a class that is declared as static is called the Static Variable. It is also called as the “Class variable”. Once the variable is declared as static, memory is allocated only once and not every time when a class is instantiated. Hence you can access the static variable without a reference to an object.

2. Answer: Method overloading increases thereadability of the program. Overloaded methods give programmers theflexibility to call a similar method for different types of data. Overloading is also used on constructors to create new objects given different amounts of data.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sayeada Ummal Fatema -
1.The static keyword in Java is used mainly for memory management. It is used with variables, methods, blocks, and nested classes. It is a keyword that is used to share the same variable or method of a given class. This is used for a constant variable or a method that is the same for every instance of a class. The main method of a class is generally labeled static.

2. The advantages of method :
The methods help in data security.
The methods also enable polymorphism.
Methods can be overloaded or overridden.
Methods allow recursion and it acts as a loop.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md Hasan Al Rashid -
1.
In Java, static keyword is important for worst the memory.static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class.
2.
For help of method we can declaire variable one time.method have many advantages such as:

The methods help in data security .
The methods also enable polymorphism .
Methods can be overloaded or over ridden .
Methods allow recursion .
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Kamruzzaman Kowshik -
1. Answer: In Java, static keyword is mainly used for memory management. It can be used with variables, methods, blocks and nested classes. It is a keyword which is used to share the same variable or method of a given class. Basically, static is used for a constant variable or a method that is same for every instance of a class. A member variable of a class that is declared as static is called the Static Variable. It is also called as the “Class variable”. Once the variable is declared as static, memory is allocated only once and not every time when a class is instantiated. Hence you can access the static variable without a reference to an object.

2. Answer: Method overloading increases the readability of the program. Overloaded methods give programmers the flexibility to call a similar method for different types of data. Overloading is also used on constructors to create new objects given different amounts of data.