Scala - Error in Inheritance: <console>:: error: not found: value

0 votes

Hello , I am facing the below issue while executing the below code.

Can you please assist?

class vehicle (year:Int){

var Year = year

def cardet(name:String) {

var Name = name

println("Car name" + " " + name + " " + "Year" + " " + year)}}


class car(Speed:Int) extends vehicle(year){

var model = " " 

def printc() = { "Model " + " " + model + "Speed" + "  " + Speed + "Year" + "  " + Year}

}

<console>:8: error: not found: value year

       class car(Speed:Int) extends vehicle(year){
Aug 1, 2019 in Apache Spark by Ramya
472 views

1 answer to this question.

0 votes

You need to declare the variable which you have in the parent class in the derived class as well. Refer to the below screenshot,image

answered Aug 1, 2019 by Karan

Related Questions In Apache Spark

0 votes
1 answer

Scala: error: value unary_+ is not a member of (Int, Int)

All prefix operators' symbols are predefined: +, -, ...READ MORE

answered Jul 22, 2019 in Apache Spark by karan
171 views
0 votes
1 answer

where can i get spark-terasort.jar and not .scala file, to do spark terasort in windows.

Hi! I found 2 links on github where ...READ MORE

answered Feb 13, 2019 in Apache Spark by Omkar
• 68,880 points
187 views
+1 vote
1 answer

Error: value textfile is not a member of org.apache.spark.SparkContext

Hi, Regarding this error, you just need to change ...READ MORE

answered Jul 4, 2019 in Apache Spark by Gitika
• 25,460 points
510 views
0 votes
1 answer

Error : split value is not a member of org.apache.spark.sql.Row

spark.read.csv is used when loading into a ...READ MORE

answered Jul 10, 2019 in Apache Spark by Rishi
1,007 views
+1 vote
1 answer
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,840 points
3,926 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,840 points
542 views
+1 vote
11 answers

hadoop fs -put command?

put syntax: put <localSrc> <dest> copy syntax: copyFr ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Aditya
20,927 views
0 votes
1 answer

Scala: 30: error: value partitions is not a member of String

Try this code: val rdd= sc.textFile (“file.txt”, 5) rdd.partitions.size Output ...READ MORE

answered Jul 29, 2019 in Apache Spark by Nijit
138 views
+1 vote
1 answer

How can I write a text file in HDFS not from an RDD, in Spark program?

Yes, you can go ahead and write ...READ MORE

answered May 29, 2018 in Apache Spark by Shubham
• 13,370 points
2,042 views