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 an adapter pattern?

An adapter pattern is a structural design pattern which translates one interface for a class into a compatible interface.

What are the differences between Objected Oriented Programming and Procedural Oriented Programming?

Procedural oriented programming generally consists of a main program line that executes and does whatever it's supposed to do (branching off statements, loops etc..). You could say it is very functionally oriented like C, Fortran.

OOP is more about the entities which perform the processes than about the processes themselves. This leads to encapsulation. For ex, if you want to design a procedural program that reads in a text file and inserts the data into a database, you would have a procedure that

1. Parses the text file according to what you want,

2. Construct the necessary queries for the database,

3. Establish a connection to the database and finally,

4. Perform the data insertion.

This in OOP would consist (off the top of my head) of 3 classes;

1. Parser class which gets the data out of the textfile.

2. The query builder which returns SQL queries.

3. A Database connector class which connects to the database and performs the queries.

Here we aren't concerned with the internals of the parser or query builder. All the connector cares about is that the parser returns a dataset in a specified format and that the querybuilder returns a set of appropriate queries given the dataset.

What is the difference between training and development?

Training is focused on individual tasks, all nuts and bolts ... how to turn a wrench. Also, training has a beginning and an end.

Development is the whole person concept. Not only teaching them how to turn the wrench, but also why we turn the wrench and challenging them to figure out a better way to turn that wrench. It is focused more on cultivating the individual to give them the tools to work upward through greater job and relationship complexities. The job of development has no end.

In the modern organization, staff development energizes an organization's culture by grooming it's future leaders.

Example of a enrollment system in a flowchart?

Well, an enrollment system in a flowchart will depend on how many enrollments and departments your company has. It is basically a customizable chart.

What can you do in the CUPS web interface?

In the CUPS (Common Unix Printing System) web interface, users can manage printers and print jobs, configure printer settings, and monitor print queues. It allows for the addition and removal of printers, adjustment of their properties, and troubleshooting of printing issues. Additionally, users can view detailed information about print jobs, including their status and owner, and can cancel or hold jobs as needed. The interface provides a user-friendly way to manage printing on Unix-like operating systems.

How much height to loop the loop?

The height of the loop depends on the entry speed The diameter is usually adjusted to provide 1g acceleration in the upward direction to the upside-down passengers.

Technically, if the entry speed is the variable, and you don't worry about smashing the passengers or the g-forces, the loop can be ANY size.

What is a stringbuilder and stringbuffer?

Strings are extremely useful but at the same time resource intensive too. In programs where numerous strings are used which need to be altered every now and then, it is advisable to use the StringBuffer or the StringBuilder class.

The java.lang.StringBuffer and java.lang.StringBuilder classes should be used when you have to make a lot of modifications to strings of characters. As we discussed in the previous chapter, String objects are immutable, so if you choose to do a lot of manipulations with String objects, you will end up with a lot of abandoned String objects in the String pool. On the other hand, objects of type StringBuffer and StringBuilder can be modified over and over again without leaving behind a great list of discarded String objects.

StringBuffer vs. StringBuilder

The StringBuilder class was added in Java 5. It has exactly the same API as the StringBuffer class, except StringBuilder is not thread safe. In other words, its methods are not synchronized. (For now just know that syncrhonized is used for thread safety and causes an overhead in terms of performance) Sun recommends that you use StringBuilder instead of StringBuffer whenever possible because StringBuilder will run faster. So apart from synchronization, anything we say about StringBuilder's methods holds true for StringBuffer's methods, and vice versa.

Discuss final method and final classes?

a method declared final can not be overridden, and a class declared as final can not be extended by its sub class.

When should you use static method and when should we use instance method?

Non-static methods are the "normal" type of methods for a class to have. They use instance variables to perform certain actions. In other words, object A and object B of the same class may behave differently when we call one of their Non-static methods depending on the value of their instance variables. Static methods on the other hand behave the exact same way for all instances of a class. object A and B of the same class will act in the same way when we call one of their Static methods. (*NOTE* Static methods cannot use instance variables)

Write a program that randomly fills a 10 component array then prints the largest and smallest values in the array?

final double[] ns = new double[10];

final Random rnd = new Random(System.currentTimeMillis());

// Fill...

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

ns[i] = rnd.nextDouble();

}

// Get largest/smallest...

double largest = Double.MIN_VALUE;

double smallest = Double.MAX_VALUE;

for (double n : ns) {

if (n > largest) {

largest = n;

}

if (n < smallest) {

smallest = n;

}

}

// largest and smallest are now the proper values.

What are the types of variables?

THE TYPES OF VARIABLES

1.Constant or Controlling Variables

  • variables that you do not change all throughout the experiment.

2.Manipulated Variable

  • variable that you change in the activity.They are also called the Independent Variable

3.Responding Variable

  • variable that result by changing the variable
  • also called as the Dependent Variable in doing such activity ,Far Test can be achieve by changing only one variable at a time.

How is a constructor in the super class called?

By using the reference super();

When you invoke super(); the JVM knows that you are trying to invoke the constructor from the parent class and calls the super class constructor automatically. In fact, the invocation to super(); is usually the first line of any class constructor. This is done to ensure that all the parent class objects are initialized before the current child class is created.

What is the prototype of a copy constructor for a class X?

class X { public: X(); // default constructor X(const X& x); // copy constructor // ... }; int main(void) { X objx1; //normal ctor X objx2 = x1; // copy ctor X x3(x2); // copy ctor }

What is meant by a 'concrete command'?

It means that you have to do it now. So if someone tells you a concrete command you better do it

Maximum client for odbc connection?

Maximum client is the maximum number of requests that can be served by webserver at a time.

Is special symbols are valid as a string in java?

Yes. Any special character inside the String is considered as part of the string variable and would not be treated as a special character.

Ex:

String str = "ABC_$4";

is a valid string declaration

How do you Send arrays to function?

Simply by sending the base address from main() and catching that in a pointer in the pointer.

void main()

{ int a[20];

sort(a);

}

void fun(int *p)

{

}