- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
I am not able to figure out what's wrong with the following code: Is it a rule to create objects in class that contains main method and then use this object to access the methods? I did exactly reverse in the following code and i am not able to compile … |
|
This is my code: //VariableArguments3.java public class VariableArguments3 { static void test(String s,int ...v) { System.out.println("length:"+v.length+" String:" +s); for(int x:v) System.out.println("x="+x); } static void test(String s,double ...d) { System.out.println("length:"+d.length+" String:" +s); for(double x:d) System.out.println("x="+x); } } and //VariableArguments3.java public class VariableArguments3Test { public static void main(String args[]) { VariableArguments3.test("harshal",33,43,34,23,24); VariableArguments3.test("hosha",43,442); … |
|
This is my code: //VariableArguments1.java public class VariableArguments1 { static void test(int ...v) { System.out.println("length:"+v.length); for(int x:v) { System.out.println("x="+x); } } } and //VariableArguments1Test.java public class VariableArguments1Test { public static void main(String args[]) { test(33,43,34,23,24); test(43,442); test(); } } Following are the errors i am getting: VariableArguments1Test.java:5: cannot find symbol … |
|
Re:
import java.util.Scanner; public class waterbill8 { public static void main(String[] args) { Scanner reader = new Scanner(System.in); double value1 = 5.00; double value2 = 0.82; double value3 = 0.65; double value4 = 0.42; double value5 = 15.00; double value6 = 1.47; String read1 = null; char I, R; int num1, … |
|
I think the following code should print 26 but it's printing 62 instead. public class gjh { public static void main(String[] args) { int x = 2; x += ++x * ++x * ++x; System.out.println(x); } } So how is this possible? |
|
when i use following code i do not get correct output: In this the function maxHeartRate returns an Integer value.Lets take it equal to 199. public String targetHeartRate() { double a = maxHeartRate()/2; double b = ((85/100)*(maxHeartRate())); String c = a+"-"+b; return c; } Using above code i get String … |
|
I know how the ++ operator and -- operator works.This is my code to count the no of digit in an integer and it works perfectly. import java.util.Scanner; public class modified_sepadigit { public static void main(String args[]) { Scanner input=new Scanner(System.in); System.out.println("Enter a number"); int no=input.nextInt(); int noOfDigit=0; int tempNo=no; … |
|
i have been coding a client server program to calculate factorial of a no . The client will pass the no to the server whose factorial is to be calculated. Now the problem that i am encountering is that no matter what value i am passing to client(variable msg in … |
|
So here is something i am trying to do: 1.Store a mathematical expression eg. 23*32+12 in the String datatype. 2.Now i have to calculate the value of that expression. So i thought of converting the string to integer using parseInt , but for this the string need not contain *,+ … |
|
Re:
hi........ i'm new to java...... i m running a java program on cmd prompt,i want to compile but i m getting error like [B]'javac' is not recognised as internal and external command ,operable program [/B] plzzzzzzzzzzz help me:) |
|
When i make 2 object for a same class, and then i make one object equal to another, then changes made to one object affect another object also, then when i assign one object as "null" then why the change is not made to another object as well? Here is … |
|
I want to create text files(empty) depending upon the user input, suppose if the user enter 20 , then it should create 1.txt,2.txt to 20.txt Assuming i want to create 2o files, then i wrote the foll code: [CODE] for i in range(20) filename="i.txt" fp=open('filename','w') fp.close() [/CODE] but i know … |
|
HI!! I would like to know some of the alternatives for java swing. I have to create some kind of multithreaded bots for multiple account creations,Scraping etc. using proxies.Although i would like to ask is Java capable of handling this type of bots,because i have read over the internet that … |
|
today i was learning about jagged arrays.So i wrote the following code, i wanted to use foreach loop with it, but i am getting following error: Cannot convert type 'int[]' to 'int' on line 31. The code is as follows:[CODE]using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ArraysExplained { … |
|
I am using turbo c. I have a 2mb text file "tryy.txt" , so what i am trying to do is ,i am scarping the urls from the text file and saving it into another file. Now, after running the program, i get a meassage as "Null Pointer Assignment" on … |
|
what does an array contain when it is declared? For example, when i declare an int array numbers like: int[] numbers=new int[5]; now without intializing any values, i tried to print that array.So it showed me that all elements inside that array were 0. Now if 0 means empty, then … |
|
Re:
[CODE]#include<stdio.h> #include<conio.h> #include<dos.h> main() { int a,b,c,number; clrscr(); int ad() { clrscr(); printf("Enter first number"); scanf("%d",&a); printf("Enter second number"); scanf("%d",&b); c=a+b; printf("The answer is %d",c); } int sub() { clrscr(); printf("Enter first number"); scanf("%d",&a); printf("Enter second number"); scanf("%d",&b); c=a-b; printf("The answer is %d",c); } int mult() { clrscr(); printf("Enter first … |
|
Re:
Hello..! I am newbie to java and I have got frustrated using notepad, can anyone please suggest me a good compiler for java. I am using Windows 7 as O.S. |
|
i have to convert a string into ascii format and then into it's binary. I know how to convert between int to binary using toBinaryString, so how to convert ascii to int. Or is there any other way to convert string characters into binary form. In short suppose there is … |
|
Re:
Hi Guys, I have a problem which in java i have a method called turn() is there a way to count the amount of times it gets called upon, ultimately counting the amount of turns? |
|
i have two classes:parentbox and chiildbox [CODE]class parentbox { int width; int height; int length; }[/CODE] [CODE]class chiildbox { public static void main(String args[]) { parentbox babybox1= new parentbox(); parentbox babybox2=babybox1; babybox1.height=10; babybox1.length=19; babybox1.width=2; int vol; System.out.println("the vol of babybox1 is"+(babybox1.height*babybox1.length*babybox1.width)); //parentbox babybox2=babybox1; System.out.println("Now babybox2 contains:"); System.out.println("babybox2.height=",+babybox2.height); System.out.println("babybox2.length=",+babybox2.length); System.out.println("babybox2.width=",+babybox2.width); } … |
|
Re:
I've already read the stickied about "STarting java" but the thing is I am not starting java, soo my question is, what's the best book to learn core java and Java EE? and what's their difference and it would be good if you will site the books you've read regarding … |
|
I started learning python3 some 3-4 days ago.My ultimate aim to learn this language is to design web apps(eg apps to automate account creations for seo etc.) For this i guess i will have to use django or turbogears for this, but now i came to know that django or … |
|
i am using python idle in windows7 to run my program. whenever i try to run the program i get an syntax error as unexpected indent. the code i am trying to run is as follows: [CODE]def print_lol(movies): for each in movies: if isinstance(each,list): print_lol(each) else: print(each)[/CODE] |