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

What is hypernet?

HyperNet is a dial up Internet accelerator that boosts your Web surfing experience using your existing phone jack and modem with NO additional equipment and NO waiting! It's the hi-speed surfing solution with the convenience of dialup Internet Service!

What is krishnamurthy number?

A krishnamurthy number is one whose sum of the factorials of each number is equal to the number itself. Example
145
sum of factorial of each digits = 1+24+120 = 145 which is the number itself.

What is statement and blocks?

A statement is a single instruction in a language; a block is a group of instructions.

What are high and low level languages?

Low level languages expose the internals of a computer's processor and allow you to take advantage of the power of that processor. Every processor has an assembler which allows you to code directly the machine language processed by the processor. This is the lowest level language available, however, the downside is that you are stuck producing code for only one processor and it will take a long time to write any significant program.

The next higher level language will be things like C, which are compiled fairly efficiently down to the machine level. C being higher level can be written and supported by many processors out there. It takes less C code to write a significant program than assembler.

The higher the level of a language the less code that is necessary to write a significant program, however, these programs are no longer efficient in terms of the amount of machine language generated. These programs often run slower and require large amounts of code to do simple things; this is counterbalanced by the ability to get complex things done with very little code. Many higher level languages are called 4GL for 4th generation languages.

A quantitative definition of 4GL has been set by Capers Jones, as part of his work on function point analysis. Jones defines the various generations of programming languages in terms of developer productivity, measured in function points per staff-month. A 4GL is defined as a language that supports 12-20 function points per staff month. This correlates with about 16-27 lines of code per function point implemented in a 4GL.

Benefit of inner class in java?

Inner classes are very useful for classes that are written specifically to be used with the encompassing class. A good example of this would be a LinkedListNode class being part of a LinkedList class:

public class LinkedList {

private LinkedListNode root;

private class LinkedListNode {

private Object data;

private LinkedListNode nextNode;

}

} No class except your LinkedList class needs to know anything about the LinkedListNode class. So we hide it so no one else needs to worry about what it does.

What are non static members in Java?

Local variables (on the stack) or dynamically allocated variables (in the heap) are nonstatic variables. Static variables, constants and globals are all allocated in the program's data segment.

Why do you need to implement FTP in JAVA?

FTP is a commonly used protocol used to transfer files. There are many ready-made solutions; it might not be necessary to program it. On the other hand, you may need to integrate FTP into some other application. In other words, if you already decided to program in Java, you may need to add FTP capabilities to it.

How does Java decide which method with the same signature to use when the method exists in several levels of a class hierarchy?

Java uses the least-abstract implementation of a method. If a method is called on an object, it searches the current object for an implementation. If no such implementation exists, Java looks to the object.super class for the method. It keeps searching up the superclass list until it finds a method or gets to the Object superclass and throws a NoSuchMethodException.

Write a program to show the applet life cycle?

  1. /*
  2. Applet Life Cycle Example
  3. This java example explains the life cycle of Java applet.
  4. */
  5. import java.applet.Applet;
  6. import java.awt.Graphics;
  7. /*
  8. *
  9. * Applet can either run by browser or appletviewer application.
  10. * Define tag within comments as given below to speed up
  11. * the testing.
  12. */
  13. /*
  14. */
  15. public class AppletLifeCycleExample extends Applet{
  16. /*
  17. * init method is called first.
  18. * It is used to initialize variables and called only once.
  19. */
  20. public void init() {
  21. super.init();
  22. }
  23. /*
  24. * start method is the second method to be called. start method is
  25. * called every time the applet has been stopped.
  26. */
  27. public void start() {
  28. super.start();
  29. }
  30. /*
  31. * stop method is called when the the user navigates away from
  32. * html page containing the applet.
  33. */
  34. public void stop() {
  35. super.stop();
  36. }
  37. /* paint method is called every time applet has to redraw its
  38. * output.
  39. */
  40. public void paint(Graphics g) {
  41. super.paint(g);
  42. }
  43. /*
  44. * destroy method is called when browser completely removes
  45. * the applet from memeory. It should free any resources initialized
  46. * during the init method.
  47. */
  48. public void destroy() {
  49. super.destroy();
  50. }
  51. }
  52. What does generate random numbers mean?

    It means to get a number, randomly, from a certain range of numbers.

    It means to get a number, randomly, from a certain range of numbers.

    It means to get a number, randomly, from a certain range of numbers.

    It means to get a number, randomly, from a certain range of numbers.

    When is a number called a 'Sunny' number?

    A number is said to be 'sunny' when, 1 added to that number, the square root of it becomes a whole number...

    What ways can object oriented systems be considered cure to the software crisis?

    It isn't clear what you mean by the "software crisis". The benefits of object oriented systems are usually in the re-use of code (not having to write the same type of code over and over again), which leads to a better ROI (return on investment).

    This means you can leverage what you already have done to get a product to market faster.

    What is the character count method?

    This method uses a field in the header to specify the number of characters in the frame. When the data link layer at the destination sees the character count,it knows how many characters follow, and hence where the end of the frame is. The disadvantage is that if the count is garbled by a transmission error, the destination will lose synchronization and will be unable to locate the start of the next frame. So, this method is rarely used.

    How you make shared and synchronized variable in java thread?

    A Variable that is shared as well as synchronized cannot be created in Java. These two terms are mutually exclusive and a variable that is synchronized in java cannot be shared and vice versa

    How do you create Write a program that takes 10 integers as input The program will place these integers into an array and display the following 1. List in ascending order 2. mean 3. median 4.max val?

    import java.util.Arrays;

    import java.util.Scanner;

    public class Answers {

    public static void main(String[] args) {

    //Creates a scanner object named console.

    Scanner console = new Scanner(System.in);

    //Variabels

    int [] numbers = new int [10];

    double avg = 0.0;

    double median = 0.0;

    int max = numbers[0];

    double count = 0.0;

    //User input.

    for (int i = 0; i < numbers.length; i++){

    System.out.print("Number: ");

    numbers[i] = console.nextInt();

    }

    //break

    System.out.println("===============");

    //finds the average and max value.

    for (int i = 0; i < numbers.length; i++){

    count += numbers[i];

    avg = count / numbers.length; //average

    if (numbers[i] > max){ //finds the max value.

    max = numbers[i];

    }

    }

    median = (numbers[4] + numbers[5])/2; //Median value

    //Display to user.

    System.out.println("Highest value found: " + max); //Show maximum value found in array

    System.out.printf("Median is: %.3f \n",median); //Show median

    System.out.printf("Average is: %.3f \n",avg); //Show average

    sortAsc(numbers); //Print out whole array ascending

    }

    //Method for sorting an Array ascending.

    public static void sortAsc(int [] array){

    for (int i = 0; i < array.length; i++){

    Arrays.sort(array);

    System.out.println(array[i]);

    }

    }

    }

    This should do everything you asked for, hope this helps!

    If you have a 55 in a class and you get an 78 on your final test will you pass the class?

    That would depend on how much of the grade the final counted for.

    ___________________________________________________________________________________________________________

    Well sometimes test scores are 30% or 40%, but the real terror is that in high school your science class will give you a grading policy that test scores are 70% of your grade, but I never fail a science test so far. Last year I fail tons of tests.

    ___________________________________________________________________________________

    At my school campus, usually the report card tells your grade. If the grade is below 70, you get held back. On the big test, (the state test) there are conditions that affect your grade and if you have, say, 20 mistakes, then you wouldn't be commended and could be held back for that reason too.

    What is a java deconstruct?

    Every class has at least one it's ownconstructort. Constructor creates a instance for the class. Constructor initiates (initialize) something related to the class's methods. Constructor is the method which name is same to the class. But there are many difference between the method (function) and the Constructor.

    In this example we will see that how to to implement the constructor feature in a class. This program is using two classes. First class is another and second is the main class which name is Construct. In theConstruct class two objects (a and b) are created by using the overloaded another Constructor by passing different arguments and calculated the are of the different rectangle by passing different values for the another constructor.