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

How do write a program in c plus plus for addition and subtraction of two complex numbers?

#include<iostream>#include<complex>

int main () {

using namespace std;

complex a {1, 1};

complex b {42, 2};

cout a << " + " << b << " = " << a + b << endl;

cout a << " - " << b << " = " << a - b << endl;

}

Define object oriented data model?

It is based on collection of objects.An object contain values stored in instance variables within the object.An object also contains the bodies of code that operate on object.These bodies of code is called methods.Collection of instance variables and method is called classes.

Difference between class and interface in java?

A class is a data type. An interface consists of the private, protected and public members of a class, allowing consumers of the class to interact with the class representation in a controlled manner. The private interface is only accessible to the class itself and to friends of the class. The protected interface is similar to the private interface but is also accessible to derivatives of the class. The public interface is fully accessible. The private and protected interfaces are intended purely for use by the class implementers while the public interface is intended for use by both consumers and implementers.

What is tannhausers method?

ht in cm-100

deduct 10% if filipino or small frame.

What value is assigned to extern variable?

Default initial value of extern integral type variable is zero otherwise null.

How do you install java games on samsung E1410?

open net in your mobile

and download games & applications

it's easy and effective

here are some webs

gamejump.com

mobango.com

i hope to help you

Why you use constructor instead of function?

For every class an empty constructor will be defined automatically by default unless you provide a constructor definition manually. Constructor in a class can be used to initialize variables or perfrom some basic functionallity whenever an object is created.

How do you prevent a dangling else?

Answer
A "dangling else" is basically a bit of ambiguity as to how an if-then-else statement will be parsed - specifically, when the else clause should end.

A dangling else can look something like this:

void doStuff(int a) {

if(a == 10)
printf("TEN");

else
printf("NOT TEN");
a = 100;

}

The above code looks perfectly normal. If a is 10, then print "TEN" otherwise print "NOT TEN" and set a to 100.

With certain languages (C/C++ and Java included), that code would not quite work as described. The way the code is indented can make someone believe that it is doing something else.

According to the way C/C++ and Java would interpret the above code, it should look more like this:


void doStuff(int a) {

if(a == 10) {
printf("TEN");

}else {
printf("NOT TEN");

}

a = 100;

}

Which means that no matter what, a would be set to 100 at the end of the function call, which is not how the indentation made it look in the original example.

Keep in mind that both examples are identical in function if interpreted by a C/C++ or Java style compiler.

Answer
This problem arises with nested if-s:

if (cond1) if (cond2) stmt1; else stmt2;


It can be either

if (cond1) { if (cond2) stmt1; else stmt2; }


or

if (cond1) { if (cond2) stmt1; } else stmt2;


It is important to rembember that the compiler does not know which of those you meant, so it choose the first interpretation: the dangling else belongs to the inner if.

What is the difference between base class and derived class in c plus plus?

There is no difference other than that a derived class inherits from a base class. That is, the derived class inherits all the public and protected members of its base class, and is a more specialised form of its base class. Thus both can be treated as if they really were base classes. The derived class can also override the virtual methods of the base class, thus allowing polymorphic behaviour without the need to know the exact type of the derived class.

What are the differences between an abstract class and an interface in java?

They are very different.

An abstract class is a class that represents an abstract concept (google define "abstract" if you're unsure) such as 'Thoughts' or 'BankAccount'. When a class is defined as abstract it cannot be used (directly) to create an object. Abstract classes are used as super-classes so that all of their subclasses inherit all methods.

Interfaces can be thought of as contracts with all of their implementing classes. They simply require all implementing classes to have methods with the same signature as that defined in the interface, but such methods can behave as appropriate.

Hope that helps :)

Write a c program divisible by 3 and 5 or not?

void main(){ int i,j; scanf("%d",&i); if((i%5)==0) printf("the given number is divisible by 5); }

What are the different types of data types used in c.net?

In C#, data types can be categorised as

  1. Value Types.
  2. Reference Types.

Value Types

Variables defined from Value Types store values. Copying one value type caribale tp another, doesn't affect the priginal vraible.

They can be further categorised into: -

1) structs: - They can be numeric (int, float, decimal), bool, user-defined structs.

2) Enumerations: - They consist of a set of named constants. By default the first enumerator has value=0.

Reference Types

These objects store references to the actual data. These can be categorised into: -

1) Classes: -- They encapsulate data and its functionality into a single entity called OBJECT.

2) Interfaces: - These are used to declare the signatures, blurprints of methods, delegates and events.

3) Delegates: - These contain the addresses/references to a method.

For more information refer to related links.

What are different ways by which you can access public member functions of an object?

You simply access it. That's what public means. You can access a public member from any other class, or even from non class code, so long as the referenced class is in scope to the referencing code. In order to do that, you need to have a reference (directly or indirectly) to the instance of the class you want to reference. This would generally be passed as an argument to the referencing code.

What are some ideas for mini projects in Java?

Depends on what you want the project to teach.

What project list would be complete without the standard Hello World project? Learn the creation of classes, use of the main method, and standard output.

Projects which deal with calculating mathematical concepts are common. Factorials, GCD, LCM, area of geometric shapes, etc. Also, simple string manipulation projects, like printing out a string of a firstname-lastname pair, then switching them. Use arrays or other data structures to process many of these calculations and store the answers.

As above, except have the functions calculated by input given through the command line by the user.

Specific example: Have the user enter any number of integers as command line arguments to have their factorials calculated. If one of the inputs is not an integer, print an error message. If one of the inputs would result in a factorial that would be too large (greater than 20 for a long integer), print an error message. Otherwise print the factorial of the number.

Other points of this exercise are to validate input and (possibly) use a recursive solution for a problem.

As above, except take input via standard input.

Specific example: Have the user enter numbers (either integer or floating point). Keep track of all unique numbers entered until the user enters non-numeric data. Once done accepting input: print all numbers in order from least to greatest, print the sum/mean/median/mode of the numbers, and print how many numbers entered were integers and how many were floating point.

Other points of this exercise are to consider various types of data structures, sorting data, parsing data, and filtering data.

As above, except take input from files and direct output into files.

Specific example: Have the user specify two file names on the command line. The first will be our input file, the second will be our output file. The program should exit with an error message if: there are an incorrect number of command line arguments, both are the same file name, or either specifies a file that does not exist. Otherwise, the first file will contain a series of lines of text. Each line will have three parts, separated by a space character. Each line will contain one part containing entirely numbers, one part containing entirely lowercase letters, and one part containing entirely uppercase letters. The parts of each line will be in a different order. The program will parse each line and write them to output in the following format: "(number part,lowercase part,uppercase part)".

Other points of this exercise are to learn exception handling (must-have with file I/O), data type recognition, and output formatting.

As above, except make it look pretty.

Specific example: Have the user enter three values into a text box, then press a button. The program will interpret the three values as the length, width, and height of a cuboid (3D rectangle). The button will cause another window to pop up and display information about the cuboid: volume, surface area of each of the three distinct sides, total surface area, and distance from one corner to the opposite corner. Finally, (and most importantly?) ensure that the program exits when the user closes the window.

For extra difficulty, implement the following: Do not allow the three input boxes to record any non-numeric characters. Make the popup window block input to the original window until it is closed. Use a layout which will ensure that the input window will both allow for resizing and space out the components evenly whenever the window size changes.

Other points of this exercise are sub-concepts of GUI building: component layout, event handling, and "graceful" exits from a program.

As above, except read and write input between networked computers.

Specific example: This will require two different programs running on remote machines. Have the user enter a string in the date format: "MM/DD/YYYY". Ensure that the date is in the past. Continue asking for input until a valid date is entered. The program should then connect to a remote computer and send the date string over. At this point, the program running on the remote computer will analyze the string and determine what day of the week that date was. The remote program will then take today's date and figure out when the next day (tomorrow or later) will be that will be the same day of the week. It will send this back to the original program. The original program will print this value out and both programs will exit.

By "reflection" I mean having to do with a program knowing information about itself. Have the program read information from itself or even have it modify some of its methods and execute itself.

Specific example: Have the user input the name of a class. The program should display information about each method in the class in the format: "access_modifier return_type method_name(parameters) [throws exception_types]"

Another (harder) specific example: Have the user input any valid code, a single line at a time. When the user specifies, execute the code and display the results (if any).

If you didn't figure it out already, just take the simple calculations from the first section and incorporate them into any new concept you want to teach.

How much does java cost?

Depending on whether you are a Web Designer or Web Developer. Many will wonder, What is the main difference between those two?

First off, there is a difference between a web designer and a web developer. Those of us fortunate enough to posses both sets of skills are the lucky ones who get to say "Yes" when asked if they can do a project. No matter what the project is. Then there's the OTHER group. Those who SAY they can do what you need.

Web Designer: A designer designs the style, colors and images on a website, and about 90% of the time they can also do simple HTML (the language which make a website actually work, where you can click on links to see other pages, etc...)

Web Developer: A developer can program a website to DO things, not just show pages of information. For example, perhaps you want to have a feature where the user / customer can search for stores by zip code or browse items in a catalog, have a shopping cart, sign up for a newsletter, login to the site with a password, have a database of items to download, etc...


So the basic difference between design and development is that one provides you with simple pages (About Us, Company History, Contact Us, etc...) these are called static sites. The other allows your site to actually do something, not just show information. These are called dynamic sites or a web application.

Dynamic sites typically cost more because they require more time, expertise and resources to develop.

These days, there is a huge demand for Flash (animated, perhaps with sounds, etc.) sites. These sites typically cost more because they require a level of artistic AND programming skills. Many designers will buy a template (a pre-made design) and just change the logo, name of the company and information and sell you the site. While this is a cheap and quick solution, you run the risk of having your site look like OTHER sites that have purchased that same template, thus reducing your credibility. Often times people want Flash websites without understanding that they don't NEED them and they can often be negative to your image. Flash is great for many websites, but awful for some.

Sorry about long response however experienced Web Developer can earn up to 70-100k/year or up to $50/hr on contract.

Swapnil Amin

What is fixed methods in java?

A java method is a series of statements that perform some repeated task. Instead of writing 10 lines of code we can put those ten lines in a method and just call it in one line. It is like a shortcut.

For example if we had to repeatedly output a header such as: System.out.println("Feral Production");

System.out.println("For all your Forest Videos");

System.out.println("427 Blackbutt Way");

System.out.println("Chaelundi Forest");

System.out.println("NSW 2473");

System.out.println("Australia");

We could put it all in a method like this: public static void printHeader(){

System.out.println("Feral Production");

System.out.println("For all your Forest Videos");

System.out.println("427 Blackbutt Way");

System.out.println("Chaelundi Forest");

System.out.println("NSW 2473");

System.out.println("Australia");

}

And to call it we simply write: printHeader();

And it will print out:

Feral Productions

For all your Forest Videos

427 Blackbutt Way

Chaelundi Forest

NSW 2473

Australia

Java methods provide us with features to pass arguments to it and also return values from it.

How do you draw object oriented design of Library Management System?

well ladies and gentelmen kal hai shanivar is the...post office me banta hai card adhaar is the!! :p

NOW seriously,,,take a paper and make the gola with pencil, and take a actor with straight hands and legs and join the gola with the actor using teer..

and u will have ur pyaara data flow diagram.

What are the objectives of Job Data Documentation?

Objectives or Purposes of Job Analysis

Conducting this analysis provides support for the accomplishment of your organization's strategic business objectives.

The list of objectives will include the following:

to assist in the preparation of up-to-date job description and job specification

to ensure effectiveness of recruitment exercises

to aid in formulating an effective performance management system

With reference to recruitment, Wikipedia states that

"the main purpose of conducting job analysis is to prepare job description and job specification which in turn helps to the hire right quality of workforce..."

It must also meet your employees' needs. This is shown by the way how job analysis can assist in designing a good performance management system.

How does one use string to int Java?

Yes as long as the value of the string is an integer. String str = "12345"; int i = Integer.parseInt(str); Note: This code would work very well for strings that have numeric values inside. If your string can contain any kind of data, remember to surround this code with a try catch block to ensure that you don't get an exception that crashes your system. Some of us usually miss the try catch block expecting ideal input. But once in a while we get some data that is different to what we are expecting in our code which crashes our system. Instead of spending hours trying to figure out what crashed our app, its easier to have a catch block do the work :)

How do you print the revers string?

u got a String A

String B stores the reverse

A="John"

use a reverse loop.

for(int i=A.length();i>0;i--)
{
p=A.charAt(i);
B=B+p;
}

thats it u got the reverse in B


In Java, you can just use the build-in method of the class StringBuffer.

Write a program in C language to convert infix expression to postfix expression?

#

/**************************//**********cReDo**********//*****mchinmay@live.com***///C PROGRAM TO CONVERT GIVEN VALID INFIX EXPRESSION INTO POSTFIX EXPRESSION USING STACKS.#include#include#include#define MAX 20char stack[MAX];int top=-1;char pop();void push(char item);int prcd(char symbol){switch(symbol){case '+':case '-':return 2;break;case '*':case '/':return 4;break;case '^':case '$':return 6;break;case '(':case ')':case '#':return 1;break;}}int isoperator(char symbol){switch(symbol){case '+':case '-':case '*':case '/':case '^':case '$':case '(':case ')':return 1;break;default:return 0;}}void convertip(char infix[],char postfix[]){int i,symbol,j=0;stack[++top]='#';for(i=0;i{symbol=infix[i];if(isoperator(symbol)==0){postfix[j]=symbol;j++;}else{if(symbol=='(')push(symbol);else if(symbol==')'){while(stack[top]!='('){postfix[j]=pop();j++;}pop();//pop out (.}else{if(prcd(symbol)>prcd(stack[top]))push(symbol);else{while(prcd(symbol)<=prcd(stack[top])){postfix[j]=pop();j++;}push(symbol);}//end of else.}//end of else.}//end of else.}//end of for.while(stack[top]!='#'){postfix[j]=pop();j++;}postfix[j]='\0';//null terminate string.}void main(){char infix[20],postfix[20];clrscr();printf("Enter the valid infix string:\n");gets(infix);convertip(infix,postfix);printf("The corresponding postfix string is:\n");puts(postfix);getch();}void push(char item){top++;stack[top]=item;}char pop(){char a;a=stack[top];top--;return a;}//mail me: mchinmay@live.com

What the difference between pretest loop and posttest loops?

The difference is that pre means before and post means after in Latin so it's tested before or after. :)

What are the restriction on static functions in java?

Static Methods Can:

  • Access only static variables
  • Invoke other static methods only

Static Methods cannot:

  • Access Instance variables
  • Invoke instance or non-static methods