I was messing around with writing Java code without an ide, and compiling/running with command prompt. When I try to create the .class, I get an error saying that Javac is not recognized. I was looking for answers when I found this thread https://stackoverflow.com/questions/1299750/javac-not-recognized But nothing was working. I have done the following Set C:Program FilesJavajre1.8.0_51bin as a path Set
Tag: class
how to define a variable of a class type in java when the class has extends?
i have this class : and the path interface: where T , P and N are generic types. i want to define a variable FindPath in another class , and call it’s constructor , basically i want something like this : ( WNode,WNodePath are another classes i use in the generic types ) what am i doing wrong ? how
Print user inputs from 2D array using another class in Java?
I am trying to print user inputs in another class in Java. I have made a chessboard which asks the user to input strings on the board, and then, when these strings are printed on screen, I would like the output to be “You have placed piece [name] at coordinate [coordinate]”. I am trying to do this in another class
How can I access OuterClass field from InnerClass?
I’ve been learning Java and OOP for a few weeks now. Yesterday I learned inner class and outer class. I want to know the way to access field of outerClass from InnerClass when they have exactly same name. Like below, It is possible to access field of outerClass from innerClass when they have different names. When they have same name,
Casting an Object into a Class of type T
Let’s say I have an empty class called ClsA(), and a subclass of it called ClsB() like so: Supposing that we now have an ArrayList of ClsA type objects, I want to be able to count how many elements in the ArrayList are actually of type ClsA or ClsB. Based on some searching, I found out that the following function
How to search in arrayList then change?
So i’m making a supermarket program that allows to add products and sell them, so far i have this: I´d like to know how to search in Product list by name and then change the stock(subtract-n) to sell n of that product. Answer You can use Stream API to find out the product by name. Filter the list by checking
Object array with variable from another class
Worksheet Question: The question said to declare an array of 5 objects of the class Node in the main Class – I managed to this as shown below But then the question continues populate the array by objects with seqNo values assigned to 1,2,3,4,5 respectively. Then traverse the array and print the list of its object using method show() I
Variable value not being passed into another class
I’m trying to let the user to choose which option is in their menu, and setting the variables based on the option that the customer choose, but when I go to another class and retrieve it, there is no value being passed. Here is my alacarte class Here is my checkout class Here is my output Answer You have all
Java Exercise: I’m not sure what I’m doing wrong and all help is appreciated
I am working with the following pieces of code and I keep getting this error message: Error: Main method not found in class Team, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application. All suggestions, opinions, and changes are welcome as I am completely lost on why this isn’t working.
Problem at calling a constructor if the java class is in a different path
I want to save the java classes in a folder called Classes, so on NetBeans, I have created that folder, and then I have saved it the class called Jugadores.java but after doing that i am having issues to call my constructor called regisPlayer on the main class. NetBeans says that: cannot find the simbol symbol:class regisPlayer location: class Obligatorio