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

Algorithm to convert postfix notation into infix notation?

/**************************//**********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

How is java reliable?

Java is robust because it is highly supported language, meaning that unlike C you cannot crash your computer with a bad program. Also, another factor in its robustness is its portability across many Operating systems, with is supported by the Java Virtual Machine.

What does null means in java?

Null is a value that any variable can have. It means the absence of a value. However, null can only be assigned to object reference variables; attempting to execute a method on a null variable will cause the JVM to throw a NullPointerError.

What is inheritance in oops?

Inheritance is a process of inheriting members and member functions of a particular class. This means one class can use the data members and functions of another similar class. This reduces efforts as similar data members or functions do not need to be declared again and again.

How do you create methods that does not return a value?

That depends on the programming language. In C, and languages derived from C (including Java), you usually declare the return value as "void", for example:

void MyMethod(int par1, int par2) {

// Some commands here

}

How do you write a program to arrange the elements in ascending order by using selection sort technique?

#include<iostream>

#include<vector>

template<class T>

void insertion_sort (std::vector<T>& v)

{

if (v.size()<2U)

return;

for (size_t index=1; index<v.size(); ++index)

{

T value = v[index];

size_t gap = index;

size_t prev = index-1;

while (gap && value<v[left] )

v[gap--]=v[left--];

v[gap] = value;

}

}

int main()

{

std::vector<int> vect {42, 1, 27, 8, 15, 4};

for (auto v : vect) std::cout << v << '\t';

std::cout << std::endl;

insertion_sort (vect);

for (auto v : vect) std::cout << v << '\t';

std::cout << std::endl;

}

How do you use C plus plus code in Java Program?

You don't. There are two possible workarounds.

  1. Use the Java Native Interface (JNI). JNI code resembles C-style code and is able to be compiled in the native machine language of the underlying system. This is a rather complicated solution, and is not ideal for a "quick fix."
  2. Write your C++ code like normal, compile it, and use Java code to call your compiled code. You can use the Runtime.getRuntime().exec() methods to accomplish this.

How are java applets and java applications similar?

we all know the general language which is universal to internet is HTML

which is also called language of tags,(we hve nw many more languages)

java language was made in keeping mind the scenario of internet and even

it was called internet language the 2 parts of java are application and applets

technically not approx the applet are programed with java language and distributed on internet and when we have to request for them the web server which understand HTML

as a primary tool to interact wid user this HTML behave as interface so in nutshell

vital role of HTML in java applets are to be a intermediator.

hope u r satisfied wid answer.junaid niit

Object oriented disadvantages?

The only disadvantage of OOP programming is its inability to represent non objects. For example: consider a program having just one member function which prints a statement. Creating of an object doesn't make much sense but still such a disadvantage can be overcome by marking it as static, thereby emphasizing the fact that the method isn't associated to an object.

How do you install game on samsung j700 using jar or jad file?

China phones, is a term that is used to refer to Chinese-made mobile phones that are affordable low- and mid- range budget phones. Most China phones do not come with an operating system installed. Although most China phones do not support Java natively, there is a way you can install Java applications. Installing the essential tools will allow you to have access to a rich database of JAVA applications that work on almost any JAVA enabled device, including Chinese mobile phones.

Instructions

Download and install the JAVA ME (Micro Edition) on your computer. You can download Java ME configuration (also called CLDC) directly from Sun Microsystems' website.

Transfer the JAVA ME to your phone. Connect your phone to your computer and use it as a mass-storage device (similar to a USB thumb drive). If your phone doesn't have an embedded file explorer, download and install a file explorer like Fexplorer because you will need it to transfer data and applications to your china phone.

Install JAVA ME on your phone. Using your phone's file explorer, find the JAVA ME file and install it. This software will allow your mobile phone to run java applications on a small scale. To increase functionality,

Configure and download Connected Device Configuration (or CDC). The CDC will enable your phone to run the complete Java experience that is similar to Java Runtime Environment for smart phone or other high-end mobile devices. Download and install this platform. CDC or Java Runtime Environment will allow your phone to process and run JAVA programs that have been sent to multiple users.

Download your JAVA applications to your phone. Download and install your Java applications. You can find a number of free and paid for Java applications by an online search. Alternatively visit www.getjar.com, which provides the largest software of Java based applications for all models of phones.

Transfer and install the downloaded application(s) to your phone. Java applications in two file format types, .jar (Java Archive files that contain program files needed to install the application) and .jad (Java installation programs). Your phone should be able to support both types with the installation of JAVA ME and CDC. If you already have applications, transfer them directly onto the root directory of your phone's memory card. Use the file explorer you have installed to open and install the applications.

Is java's println a method?

Consider the following statement:

System.out.println ("string to be printed");

The statement begins with System.out. This is a constant that represents the default output mode, which in this case is the screen. The constant helps to read and display the data in a Java program.

The output is generated using the built-in println() method. The string that is assigned to the println() method is displayed when the statement is executed.

For example,

class Class2

{

public static void main (String args[])

{

System.out.println("Here is your string");

}

}

The above program will show the following output:

Here is your string

Why do you use synchronized block in java?

A Synchronized block is a block of code enclosed by the {} braces that has a synchronized keyword before it. This block of code is similar to a synchronized method and only one thread can access it at a time.

What are the advantages of swing components?

a. It provides Java programmers many new powerful components-- most of which we've been begging for since Java's inception. b. It gives developers a chance to create a powerful, portable application that can not only target users on any Java-compatible platform, but also target their desired look-and-feel as well. c. The distribution is easy to learn, but can also be used at varying levels of complexity to curtail to the programmer's wishes.

C program to concatenate without using strcat?

#include
#include
#include
void main()
{
char str1[30],str2[30];
int l1,l2,i;
clrscr();
gets(str1);
gets(str2);
l1=strlen(str1);
l2=strlen(str2);

for(i=0;i<=l2;i++)
{
str1[l1+i]=str2[i];
}
printf("%s",str1);
getch();
}

How do you run applet program?

By Embedding it into a HTML page, create a new file with the extension .html (like app.html) insert following code: No Java 2 SDK, Standard Edition v 1.4.2 support for APPLET!! Adjust the code for your applet file (can't help there i am not a java programmer) or just use : No Java 2 SDK, Standard Edition v 1.4.2 support for APPLET!! but i recommend the first because the applet tag is deprecated and not supported in XHTML

What does loop the loop mean?

When your tying your shoe you loop the loop or some kind of dance.

To 'loop the loop' in an aeronautical term. It is a maneuver creating a vertical circle in the sky and was first 'invented' by the pilot Lincoln Beachey prior to 1915

Why Customers prefer to develop their applications using Java or Dot net frame work?

Because that's the whole purpose of a programming language, the reason why they were developed - to make software.

Because that's the whole purpose of a programming language, the reason why they were developed - to make software.

Because that's the whole purpose of a programming language, the reason why they were developed - to make software.

Because that's the whole purpose of a programming language, the reason why they were developed - to make software.

Steps for OOP project?

Object-oriented analysis and design is a method of software design and programming. It revolves around everything in the program being an 'object' and how it reacts to other 'objects'. Object design is common in video games, with the player character, collectible items, hazards, enemies, and allies all considered 'objects'.

Why main function written as public static in java?

They are public because they must be accessible to the JVM to begin execution of the program. Main is the first method that would get executed in any class.

They are static because they must be available for execution without an object instance. you may know that you need an object instance to invoke any method. So you cannot begin execution of a class without its object if the main method was not static.

Or

Main is starting point of the program execution Main method is called by JVM there is no need for JVM to

create an object of the class just to access Main function

How do you find in java the sum of the first and last digit of 3 digit number?

String num = Integer.toString(12345); // Insert your Integer here.

int sum = 0;

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

sum += Character.digit(num.charAt(i), 10);

}

System.out.println(sum); // Simply prints the sum of the digits to standard out.

///// ALTERNATE SOLUTION:

int num = 12345; // Insert your Integer here.

int sum = 0;

while (num > 0){

sum += num % 10;

num /= 10;

}

System.out.println(sum); // Simply prints the sum of the digits to standard out.

What is spectrophotometric method?

an assay that measures the appearance or disappearance of a fluorescent.

Write a program which will read a string and rewrite it in the alphabetical order?

#include<stdio.h>

#include<conio.h>

#include<string.h>

void main(void)

{

int i,k,n;

char name[50],temp;

printf("\n enter no.of persons");

scanf("%d",&n);

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

gets(name[i]);

for(k=0;k<n-1;k++)

{

for(i=0;i<n-k-1;i++)

{

if(strcmp(name[i],name[i+1])>0)

{

strcpy(temp,name[i]);

strcpy(name[i],name[i+1]);

strcpy(name[i+1],temp);

}

}

}

printf("\n sorted list \n");

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

puts(name[i]);

}

What is overriding in java?

Providing a declaration which matches another declaration of the same name, thereby hiding the existing declaration.


In terms of object-oriented programming, overriding is the ability of a subclass to "override" and replace the functionality of a method.

Example:

class A {
f(){
print "A"

}

}


class B extends A {
// Function f is overridden.
// When B.f() is called, it will call this function instead of A.f()
f() {
print "B"

}

}

When shall you use Multiple Inheritance?

Multiple inheritance is used when a new class to be formed has to inherit characteristics from two or more classes. eg: class scientist class labourer | | | | V V -------------------------------- | class employee | -------------------------------- Multilevel inheritance is used if a derived class inherits characteristics from a base class which is a derived class (intermmediate base class). If the inheritance level is more than two then it is a multilevel inheritance. eg: class Grandfather | | V class Father | | V class son