answersLogoWhite

0

📱

Java Programming

The Java programming language was released in 1995 as a core component of the Java platform of Sun Microsystems. It is a general-purpose, class-based, object-oriented language that is widely used in application software and web applications.

5,203 Questions

Explain why naming encapsulation are important for developing large?

The ability to make changes in your code without breaking the code of all others who use your code is a key benefit of encapsulation. You should always hide implementation details. To elaborate, you must always have your variables as private and then have a set of public methods that others can use to access your variables. Since the methods are public anyone can access them, but since they are in your class you can ensure that the code works the way that is best for you. So in a situation that you want to alter your code, all you have to do is modify your methods. No one gets hurt because i am just using your method names in my code and the code inside your method doesnt bother me much.

If you want maintainability, flexibility, and extensibility (and I guess, you do), your design must include encapsulation. How do you do that?

• Keep instance variables protected (with an access modifier, mostly private).

• Make public accessor methods, and force calling code to use those methods rather than directly accessing the instance variable.

• For the methods, use the JavaBeans naming convention of set and get.

How do you declare an N-Dimensional array using Malloc?

#include <stdlib.h>

int **array1 = malloc(nrows * sizeof(int *));

for(i = 0; i < nrows; i++)

array1[i] = malloc(ncolumns * sizeof(int));

Where is pawsitive methods?

Pawsitive Methods is located in California, USA.

Void in java?

Void is a keyword in Java. It is always used in method declarations. When used in the line that declares a method, it signifies the fact that the method will not return any value. The JVM will not expect the method to return anything.

Ex: public static void main(String[] args) {}

What is a loop tool?

A loop tool is used to smooth and model clay into shape. The tool has a wooden handle and a metal loop at the end that can come in different sizes.

How do you write coding if the grade is between 70 and 100 in Java?

If you mean you want to code this as a condition, you would need to use the AND operator. For example, if your grade is stored in a variable called "grade":

if (grade >= 70 && grade <= 100) {

...

}

What is class hierarchies in java?

The top level class in Java is class Object. Every other class inherits from Object and therefore Object is the top most in the class hierarchy.

If you extend a class from Object such as class Animal and further extend Animal with class Dog then the hierarchy is as follows:

Object

|

Animal

|

Dog

Code for this hierachy is as follows:

class Animal {

}

class Dog extends Animal {

}

We don't need to write class Animal extends Object because every class extends from Object so it does not need to be stated.

How powerful was ENIAC what all could it do?

ENIAC had 20 accumulators each of which could potentially do up to 5000 additions/subtractions per second (this was its total data storage capacity as originally built). To simplify programming it had a multiplier unitthat used 4 accumulators to do multiplications by repeated addition and a divider/square rooter that used 5 accumulators to do division or square roots by repeated subtraction. Programming was done by wiring different units together with cables. With optimal programming speeds of 50000 to 100000 additions/subtractions per second could be achieved in short bursts but were impossible to sustain.

Later upgrades were added including 100 words of magnetic core RAM and a limited form of stored program operation from ROM that reduced the machine to having only one programmer accessible accumulator (the other 19 now had fixed hardware uses that the programmer could not directly control) and a maximum speed of about 800 instructions per second. This reduction in performance was not considered a problem as it dramatically simplified usability and the machine was always throttled in performance by its only input/output devices: one punchcard reader and one punchcard punch each operating at 100 cards per minute (with 8 numbers punched per card).

Its first real problem (taking 2 months to run: December 1945 .. January 1946) was simulation of Edward Teller's first hydrogen bomb design called The Super. The problem used a million punchcards and showed almost immediately that this design could not work and was a dead end. On completion of the run it was obvious that a totally different approach to hydrogen bomb design was needed.

It was a very flexible computer and could do anything a modern computer can, IF the variables of the problem could fit in its limited memory space.

Why do you use hashing and not array?

Hashing provides a method to search for data.

Hashing provides a method to search for data.

Hashing provides a method to search for data.

Hashing provides a method to search for data.

Does throws throws only unchecked exception?

You can throw any type of exception you want, including an unchecked exception.

What variables to marketers use for target marketing?

Segment marketing requires the marketer to break the total market into smaller segments by using certain variables: demographic, geographic, psychographic, and behavioristic.

Strategies in speaking?

There are a variety of strategies in speaking. These include speaking clearly, speaking at an appropriate tone, and speaking with enthusiasm.

How do you learn Java Programming?

you go to school to learn it or you can read books on your own particuarly at amazon just search java programing or google it

One of the best ways to learn a new programming language is to write programs in it. Try rooting around in the Java Programming category on this site. Look for questions like "Write a program to...?" and see if you can figure out how to answer them.

Sun (now Oracle) has a whole website dedicated to the online versions of print books about learning the various parts and techniques of Java, including a very good introduction to Java programming language.

What is hashing in Java?

Creating a Integer out of an object is called hashing. Hashing is commonly used in HashTable, HashMaps and HashSet.

For instance you have

Alex

John

Peter

Hashing on each value would generate something like

123455 Alex

123344 John

123987 Peter

when put in hashtable or hashset would be quicker to find each piece of information.

There are many algorithms available with java to get the hash of an object.

Write a program that would find the count of occurrence of largest digit in the input number?

#include
#include
void main()
{
long int n,r,m,max=0,count=0;
clrscr();
printf("Enter the Number:");
scanf("%ld",&n);
m=n;
while(n>0)
{
r=n%10;
if(r>max)
max=r;
n=n/10;
}
printf("\nLargest Digit is = %ld",max);
while(m>0)
{
r=m%10;
if(r==max)
count++;
m=m/10;
}
printf("\n\nOccurence of Largest Digit %ld is = %ld",max,count);
getch();
}

output:

Enter the Number:68596999

Largest Digit is = 9

Occurence of Largest Digit 9 is = 4