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

Why does not use pointer in java?

You do not use pointers in Java because the language designers decided to abstract memory management to a higher level in Java than in C. The reason for this is that it is easy to make mistakes using pointers and other lower level memory management techniques. These mistakes can lead to bugs. hard to read code, memory leaks that waste system resources, and security issues. Instead for the most part Java takes care of memory management for the user who can instead specify behavior though the object oriented techniques that are safer and easier to understand. The downside is that the programmers lose some control and flexibility in using memory. Also, programs using Java take a small performance hit in some cases because of the extra work Java has to do to manage memory itself.

They are, however in Java they are called references.

Does Java use the internet?

Because it supports Web-oriented architecture (If we will discuss about J2EE/ Java for Enterprise Edition). It is HTML, the language of the Internet, its protocol HTTP provides standard operating procedure for transfer of info between client and web server.


Java is not "the language of the Internet". For humans, English is the language of the Internet since it is what a majority uses to communicate, because it is the language which the IETF uses to write standards and protocols, and because most Internet hardware is configured using software in English. For computers, HTML/SGML/XML, JavaScript and Flash are all Internet languages of sorts, and all use English verbs. Java is used to implement some back-end systems, notably from Apache and Sun, but so are C, C++, Tcl, Perl, and dozens of others.


Whomever is trying to teach you that Java is the language of the Internet is relying too much on advertisements from the late 1990s for their information.

Distinguish between the Classes and Objects?

A Class is a template from which Objects are created, in much the same way as a plan of a building is a template from which a building is created... just as the building plan is a piece of paper and not a building, so a Class is not an Object.

The code for a Class describes the way in which an Object should behave when particular methods are invoked.

Why swing is used in java?

Swing is a package in Java which contains tools for building GUI application. Swing is a part of Java's foundation classes.

How much space does Java take to download?

On a Windows platform the online Java Runtime Environment (JRE) installer is approximately 0.86 MB and the installed size on disk is about 98MB.

The downloadable full Windows offline JRE installer is larger ~30.2 MB and for MacOS ~50 MB.