|
this is not the place to ask programming questions. see above comments telling you to see above.
basically just walk around all day and look above you.
good luck in the QA forum(s).
|
|
|
|
|
Slacker007 wrote: walk around all day and look above you. that's a sure fire way to fall in a hole.
|
|
|
|
|
I keep reading this as "How to write excellent insults with JavaScript."
I bet people would answer that programming question in the lounge!
|
|
|
|
|
package p_food;
public class Eat {
public static void main(String[] args){
Candy object1 = new Candy();
Choc object2 = new Choc();
object1.print();
}
}
package p_food;
import javax.swing.*;
class candy {
static void main(String args[]){
String flavor;
String dTaste;
String candy;
public void print(){
JOptionPane.showMessageDialog(null, + candy + " " + flavor + " " + dTaste + " " + "taste sweet like you, You bring me so much joy...");
}
}
package p_food;
import javax.swing.*;
class Choc {
static void main(String args[]){
String flavor;
String dTaste;
public void print(){
JOptionPane.showMessageDialog(null, + "but...." + " " + flavor + " " + dTaste + " " + "taste sweet like you, You bring me so much joy...");
}
}
}
import javax.swing.*;
class Confectionary {
double calorie;
String flavour;
String dTaste;
public void print(){
JOptionPane.showMessageDialog(null, +dTaste+" "+candy+" "+"candy taste nice!");
}
}
package p_food;
class Food {
static void main(String args[]){
double reading;
String dTaste;
}
}
HOW CAN I MAKE IT INTO 1 PROGRAM CODE?
|
|
|
|
|
That code really does not make much sense. I suggest you go to The Java™ Tutorials[^], and work through them.
|
|
|
|
|
Im self studying and purchased the ap book. I don't understand the following question:
consider a b c are integers consider this boolean expression
(a < b ) || !(( c==a * b)) && (c < a )
the answer is
c < a is false
would someone please explain HOW thats the answer? tysm
|
|
|
|
|
Ap_noob wrote: HOW thats the answer? It's not the answer. The answer will depend on the values of a, b and c.
|
|
|
|
|
If you have String array arr = {"145", "457", "784", "258"}, is there any other quicker way to convert each element of the array to Integer without using any loop? The below approach can work, but it will require each element to be explicitly converted to Integer.
myIntArray = new int[arr.length];
For(for int i=0; i
|
|
|
|
|
What is wrong for you with using the loop?
|
|
|
|
|
Azbilegt Chuluunbat wrote: is there any other quicker way to convert each element of the array to Integer without using any loop No.
Azbilegt Chuluunbat wrote: it will require each element to be explicitly converted to Integer. Well that is true whether you use a loop or not.
|
|
|
|
|
The fact that your byte array would perfectly fit into a __m128i makes me wonder if that is a homework question. I am not a Java programmer so I have no idea if it is even possible in Java. However with C you could parse it in-place with SSSE3:
#include <emmintrin.h>
#include <intrin.h>
CHAR source_array[4][4] = { "145", "457", "784", "258" };
INT target_array[4] = { 0, 0, 0, 0 };
__m128i target = _mm_loadu_si128(reinterpret_cast<__m128i *>(source_array));
__m128i subtract_me = _mm_set1_epi8('0');
__m128i numbers_array = _mm_subs_epu8(target, subtract_me);
__m128i mul_deci = _mm_setr_epi8(10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1);
__m128i deci = _mm_maddubs_epi16(numbers_array, mul_deci);
__m128i mul_centi = _mm_setr_epi16(100, 1, 100, 1, 100, 1, 100, 1);
__m128i centi = _mm_madd_epi16(deci, mul_centi);
target_array[0] = centi.m128i_i16[0]/10;
target_array[1] = centi.m128i_i16[2]/10;
target_array[2] = centi.m128i_i16[4]/10;
target_array[3] = centi.m128i_i16[6]/10;
Maybe a Java programmer can let us know if SIMD intrinsics can be translated into Java.
Best Wishes,
-David Delaune
|
|
|
|
|
Can anyone help me figure this out? I wrote the following code for my programming class.
package weekthreeassignments;
public class Odds {
public static void main(String[] args) {
int product = 1;
for (int i = 1; i <= 15; i++)
if (i % 2 == 1) {
product *= i;
}
System.out.println("Product of the odd integers from 1 to 15 is: " + product);
}
}
When I run the code I get the following error and how to fix it, but if you read the "Please define" part, I did define it that way. Why am I still erroring?
Error: Main method not found in class weekthreeassignments.Odds, please define the main method as:
public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application
C:\Users\fred\AppData\Local\NetBeans\Cache\10.0\ex ecutor-snippets\run.xml:111: The following error occurred while executing this line:
C:\Users\fred\AppData\Local\NetBeans\Cache\10.0\ex ecutor-snippets\run.xml:68: Java returned: 1
BUILD FAILED (total time: 0 seconds)
|
|
|
|
|
Seems like you created a JavaFX project, which by definitions puts application code in a JavaFX specific Application class. Thus, your main class has to extend it.
If you want to have the JavaFX GUI application, study a tutorial: JavaFX Tutorial - javatpoint
Otherwise create a normal java application project. Most IDEs call the normal java project type "Empty Project" or "Java Project".
|
|
|
|
|
That usually means that the code has been stored in the wrong folder. You should have a file named Odds.class inside your folder named weekthreeassignments. Check your build settings. As far as the actual code is concerned, it does work correctly.
|
|
|
|
|
I am interested in to see if truncating the table is actually faster than dropping and recreating it?
Does one of the write to the log?
|
|
|
|
|
There is a simple way to find the answer.
|
|
|
|
|
What did you find out when you tried both methods?
|
|
|
|
|
It may depend on things but generally speaking DROP will be faster than TRUNCATE. And TRUNCATE is faster than DELETE.
|
|
|
|
|
I would think that truncating means less "file allocation" processing (just changing a pointer?)
Dropping and recreating is essentially creating a new file / entry.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I am trying to figure out the way to invoke SQL Queries on SQL server either by using java, bash, or powershell. Is there any options to do that?
Thanks,
Azbilegt Chuluunbat
|
|
|
|
|
|
Buenos días.
Estoy siguiendo un curso en Coursera de POO en Java y en un reto de 4 preguntas, tengo solventadas 2 correctamente, pero las 2 restantes no acabo de poder con ellas.
una es la siguiente:
public boolean esOscuraLaImagen()
{
}
Puede alguien ayudarme por favor. Muchas gracias.
|
|
|
|
|
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
Estamos más que dispuestos a ayudar a aquellos que están estancados: ¡pero eso no significa que estemos aquí para hacerlo todo por usted! No podemos hacer todo el trabajo, o te pagan por esto, o es parte de tus calificaciones y no sería justo que lo hiciéramos todo por ti.
Por lo tanto, necesitamos que usted haga el trabajo y lo ayudaremos cuando se quede atascado. ¡Eso no significa que le daremos una solución paso a paso que puede entregar!
Comience explicando dónde se encuentra en este momento y cuál es el siguiente paso en el proceso. Luego, díganos qué ha intentado para que funcione el siguiente paso y qué sucedió cuando lo hizo.
Si tiene problemas para comenzar, esto puede ayudar: Cómo escribir código para resolver un problema, una guía para principiantes [ ^ ]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Message Removed
modified 8-Dec-20 9:13am.
|
|
|
|
|
Hi and thanks for looking,
Just started to learn Java and after reading various tutorials came up with this simple tables program.
My question, is it as it should be? I mean it works OK but is it coded correctly?
import java.util.Scanner;
public class MyTables {
public static void main(String[] args) {
int secondNum, answerNum;
Scanner sc = new Scanner(System.in);
System.out.println("Type a number:");
secondNum = sc.nextInt();
for (int firstNum = 1; firstNum <= 12; firstNum ++) {
answerNum = firstNum * secondNum;
System.out.println(firstNum + " x " + secondNum + " = " + answerNum);
}
}
}
|
|
|
|